[Python-Dev] Using Cython for standard library?
tjreedy at udel.edu
Wed Nov 5 18:54:49 CET 2008
Stefan Behnel wrote:
> Terry Reedy wrote:
>> Do you have any plans to support/use 3.0 type annotations so that one
>> could develop function-oriented code in 3.0 and then compile efficient C
>> (for whatever CPython version) without adding Python-incompatible cdefs?
> That is still an official TODO, but there isn't currently any support for it,
> nor any effort to implement it (patches obviously welcome).
> The problem is that it only applies to function parameters, not to local
I was presuming some type inferencing for locals ;-)
> variables or anything else, so the gain is actually very small.
Why I said 'function-oriented'.
> On the other
> hand, the "pure Python mode", as it is currently implemented, is much more
> powerful and allows you to annotate most things in Cython without loosing
> the ability to run the code unchanged in plain Python (including Jython and
> friends, although I never tested that).
Ah. Missed it. Very interesting and even better.
How is one supposed to get there from the main page?
Perhaps under "*Using early binding techniques to improve speed"
you could add "* Early binding in pure Python code." or some such.
> One really neat feature is that you can put a .pxd file next to your .py file
> and let it override the function signatures and classes. So you do not even
> need Py3 annotations, which have the obvious disadvantage of requiring Py3.
That is not much of a disadvantage for code intended to be compiled.
But the annotation is limited. Support for nested defs and generators
is much more critical.
Typo? Should 'typedef(cython.p_int)' be 'cython.typedef(cython.p_int)'?
Also, the 'enhancement' page has separate misspelled 'seperate' twice.
Terry Jan Reedy
More information about the Python-Dev