[Numpy-discussion] Updating cython directory to pxd usage: objections?

Fernando Perez fperez.net@gmail....
Wed Jun 18 23:48:59 CDT 2008

Hi all,

after I updated the pyrex code to use cython, a bit of confusion led
me to using .pxi includes instead of .pxd files and cimport.  That
turned out to be mistaken, as later clarified by the Cython team:


Would anyone object to my fixing the code to the new convention?  The
changes are minimal, the .pxi files can just be renamed and then a few
trivial modifications are done.  But I figured since this gets shipped
as canonical example code, vetting from the core developers is a good

In particular, I used:

# Import the pieces of the Python C API we need to use (from c_python.pxd):
cimport c_python as py

# Import the NumPy C API (from c_numpy.pxd)
cimport c_numpy as cnp

# Import the NumPy module for access to its usual Python API
import numpy as np

I don't know if those are the conventions people want to use.  I went
with 'cnp' for symmetry, and plain 'py' for simplicity.

The patch is otherwise an inconsequential adding of those prefixes,
since the old include mechanism was equivalent to an 'import *' while
this gives us a namespace.  I've attached the diff for the numpyx file
here for review (the actual diff is lager because of the renames, but
there's no code changes there).

Stefan, core team?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: numpyx.diff
Type: text/x-diff
Size: 3284 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080618/d2ba2727/attachment.bin 

More information about the Numpy-discussion mailing list