[Cython] Rewriting/compiling parts of CPython's stdlib in Cython

Stefan Behnel stefan_ml at behnel.de
Wed Mar 23 08:31:07 CET 2011

Robert Bradshaw, 23.03.2011 00:54:
> On Tue, Mar 22, 2011 at 4:09 PM, Dan Stromberg wrote:
>> I think it's a good idea, but I think it'd be better to use pure mode to get
>> code that runs either way, or some sort of preprocessor (I've used m4 with
>> good luck for this, though it doesn't syntax highlight nicely) to
>> automatically derive pure python and cython from the same source file.
> It doesn't hurt to explore the potential before coming up with the
> actual solution. Ideally, the .py files would not have to be modified
> at all.

Or only slightly, in an acceptable way (whatever that means in a given 
context). For difflib, for example, I could clean up a couple of things 
that I'd also frown upon in Python code, like taking off a bound method for 
__contains__, instead of using a straight and obvious 'in' test.

>> For me at least, the branch of Cython that supports generators has worked
>> flawlessly

It certainly has bugs. For example, I get C compiler warnings when 
compiling the optimised difflib. And it has disabled one of my favourite 
features, inlined generator expressions. We'll try to fix it up during the 
workshop next week.


More information about the cython-devel mailing list