The idea really was that it would never stop working, but could in time be 
replaced by other features that would make this implementable in the pxd (like 
inlineable properties on extension types, typed tuples or lists).

Consider it speeding up the ndarray Python API, not providing any C API.

Note that even before this, the 'dims' field was renamed 'shape', because it is 
shape in the Python API.

Dag
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Stefan Behnel <[email protected]> wrote:

Dag Sverre Seljebotn, 21.03.2012 22:36:
> NumPy is starting to seriously deprecating access to the member fields
> in an ndarray (it was always frowned upon, but now it is starting to
> become enforced). To support the large body of Cython code out there
> accessing these fields (arr.shape[0] and so on), we special-case
> PyArrayObject in Cython, with special knowledge of the NumPy API.
> 
> Ideally, we may introduce features in Cython in the future that allows
> specifying this kind of magic with syntax in pxd files, and then we can
> move away from special-casing NumPy.

Given the comments in this change, wouldn't it make sense to emit a visible
"this will eventually stop working" warning when user code runs into the
special casing hacks?

Just because the fields are convenient doesn't mean code should rely on
them being there when the NumPy folks say they shouldn't be accessible. As
I understand it, it's encouraged to use the accessor functions instead. If
that's what the NumPy developers want, users should just do that, should
they not?

Stefan
_____________________________________________

cython-devel mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cython-devel

_______________________________________________
cython-devel mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to