[Cython] Cython 0.16 and ndarray fields deprecation

Dag Sverre Seljebotn d.s.seljebotn at astro.uio.no
Wed Feb 29 18:06:42 CET 2012


I'm wondering what the best course of action for deprecating the shape 
field in numpy.pxd is.

The thing is, currently "shape" really gets in the way. In most 
situations it is OK with slow access to shape through the Python layer, 
and "arr.shape[0]" is often just fine, but currently one is in a 
situation where one must either write "(<object>arr).shape[0])" or 
"np.PyArray_DIMS(arr)[0]", or be faced with code that isn't 
forward-compatible with NumPy.

It would really be good to do the transition as fast as possible, so 
that all Cython code eventually becomes ready for upcoming NumPy releases.

The simplest change to make would be to simply remove all the ndarray 
fields from numpy.pxd, and inform about the alternatives in the release 
notes. That could be done in time for 0.16.

The alternatives of sounding sane deprecation warnings in just the right 
places takes more work. I can't work on that myself until PyCon 
sprints... perhaps put out 0.16.1 with just this change after PyCon 
sprints though...

Dag


More information about the cython-devel mailing list