[Cython] Pure python mode
Ondrej Certik
ondrej at certik.cz
Wed Nov 5 14:37:48 CET 2008
On Thu, Oct 9, 2008 at 10:57 PM, Dag Sverre Seljebotn
<dagss at student.matnat.uio.no> wrote:
> Robert Bradshaw wrote:
>> I'd like to release this soon. I've changed declare so it can work as
>> below (i.e. declare(var=type, ..)). For now there's no "cpdef/
>> cdefclass/earlybind/??" decorator, we'll hammer that one out later.
>> Any other comments before we commit to it?
>
> Hmm.. Well done! :-)
>
> Comments about release schedule though:
>
> For NumPy complex numbers are now in place which was the big lacking
> feature (of course, that makes native complex float support the next big
> lacking feature for numerical use). Structs/record arrays are incredibly
> near the surface (less than a day, easily), OTOH I'm very pressed on
> time at the moment, so I suppose they should not block a release.
>
> There definitely needs to be betas this time around too, the result_code
> refactoring is more dangerous than anything we did in summer. (In fact
> the issue Lisandro just posted may be related to this...)
>
> BTW, are we now anywhere near keeping a feature sync with Pyrex? I'm
> wondering if we could perhaps think again about the versioning scheme --
> the version number is getting very long to refer to, and the link to
> Pyrex seems less important than it used to. (Obviously it needs to not
> mess with packaging systems, but both 0.10 and 0.9.9 could work, rather
> than 0.9.8.2).
So the pure python mode seems to be working very nice for me. I was
following the documentation here:
http://wiki.cython.org/pure
However, one drawback is that I still need to use .pxd files to
declare cdef functions. Example:
@cython.locals(n=cython.int)
def fact(n):
...
in order for this to become a "cdef int foo()" function, I need to
have this line in foo.pxd:
cdef int fact(int n)
(And then the @cython decorator is not necessary). I'd like to have
everything in the .py file. Could that be approached by for example
something like:
@cython.locals(n=cython.int, _return=cython.int, cdef=True)
def fact(n):
...
?
Ondrej
More information about the Cython-dev
mailing list