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

Fernando Perez fperez.net at gmail.com
Thu Jun 19 00:48:59 EDT 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:

http://codespeak.net/pipermail/cython-dev/2008-April/000628.html

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
idea.

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?

Cheers,

f
-------------- next part --------------
A non-text attachment was scrubbed...
Name: numpyx.diff
Type: text/x-diff
Size: 3285 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080618/d2ba2727/attachment.diff>


More information about the NumPy-Discussion mailing list