[Cython] pxi or pxd for numpy?

Greg Ewing greg.ewing at canterbury.ac.nz
Thu May 1 01:08:36 CEST 2008


Brian Granger wrote:

> Previously, (on this list and at an in person meeting of Sage devs)
> some people were saying that .pxi files should be used for this
> purpose.  Because of these discussions, numpy.pxd was renamed
> numpy.pxi, but now this looks like a bad decision.

Indeed, I would say the opposite. You should almost
*never* use a .pxi file for anything.

The reason is the same reason that "import *" is almost
always a bad idea. When you cimport a name, it's easy
to find out where it came from, but if you get it by
including a .pxi, it can be a lot harder.

The 'include' statement is only present in Pyrex mostly
for historical reasons. If I had invented 'cimport'
earlier, it might never have existed at all.

-- 
Greg


More information about the Cython-dev mailing list