[Numpy-discussion] numpy and cython in pure python mode

Sebastian Haase seb.haase@gmail....
Tue Sep 22 01:33:07 CDT 2009


Hi,
I'm not subscribed to the cython list - hoping enough people would
care to justify my post here:

I know that cython's numpy is still getting better and better over
time, but is it already today possible to have numpy support when
using Cython in "pure python" mode?
I like the idea of being able to develop and debug code "the python
way" -- and then just switching on the cython-overdrive mode.
(Otherwise I have very good experience using C/C++ with appropriate
typemaps, and I don't mind the C syntax)

I only recently learned about the "pure python" mode on the sympy list
(and at the EuroScipy2009 workshop).
My understanding is that Cython's pure Python mode could be "played"
in two ways:
a) either not having a .pyx-file at all and putting everything into a
py-file (using the "import cython" stuff)
or b) putting only cython specific declaration in to a pyx file having
the same basename as the py-file next to it.

I have not decided which way I would like better ( for "a)": 1 file
might be easier to maintain, for "b)" it might be "nicer to look at"
not having so many declarators "all over the place")
A short example using numpy showing either way would be really nice to have ;-)


One more: there is no way on reload cython-modules (yet),  right ?  I
started looking into pyximport, but I had difficulties finding a
comfortable write-test-change-test-....-cycle  --- so far I'm using
SWIG together with a makefile and recompiling and restarting the
python session is similar there...

Thanks,
Sebastian Haase


More information about the NumPy-Discussion mailing list