[Python-Dev] Using Cython for standard library?

Calvin Spealman ironfroggy at gmail.com
Mon Nov 3 14:46:35 CET 2008

On Mon, Nov 3, 2008 at 6:29 AM, Gerhard Häring <gh at ghaering.de> wrote:
> Stefan Behnel wrote:
>> Michael Foord wrote:
>>> Moving more C extensions to an implementation based on ctypes would be
>>> enormously useful for PyPy, IronPython and Jython, but ctypes is not yet
>>> as portable as Python itself which could be an issue (although one worth
>>> resolving).
>> In the same line, moving more extensions to a high-level language like
>> Cython,
>> instead of writing them in straight C, would make a later switch to a
>> different environment a lot easier, as the extensions could be regenerated
>> with a modified Cython compiler (obviously minus some fixing of premature
>> optimisations and the like).
> Is using Cython for anything in Modules/ really an option? In my limited
> experiments with it, I did like it.
> But using it for Python standard library stuff doesn't look quite right to
> me:
> - Option 1: distribute Cython with Python and integrate into build process
> -- Ouch!

Can you be a bit more descriptive?

> - Option 2: only distribute generated source files
> -- developers still need to have Cython installed
> -- you have to trust Cython; who will really review the generated code?

Who reviews the machine code from gcc?

I would love to see the option to write the lower levels in something
other than C, but obviously any choice would have to be a good one.
Otherwise, we end up stuck or with lots of different languages all
being used and making understanding the full codebase harder. For
example, I've wondered if RPython would ever reach the point it could
be considered in the same way, but I don't think it would be wise to
consider both. So, the question I see isn't if Cython should be
allowed for standard library modules, but if the landscape of such
solutions is at a point that any of them is ready to be committed to.

Read my blog! I depend on your acceptance of my opinion! I am interesting!
Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy

More information about the Python-Dev mailing list