[Python-Dev] Let's change to C API!

Jeroen Demeyer J.Demeyer at UGent.be
Tue Jul 31 08:01:25 EDT 2018


On 2018-07-31 12:56, Victor Stinner wrote:
> We try to make CPython build as simple as possible. I'm quite sure
> that Cython rely on the stdlib.

It does rely on modules like "re" and "functools".

> Would depending on Cython open a
> chicken-and-egg issue?

Yes, that's a problem but it's not unsolvable. For example, we could use 
the PEP 399 pure Python modules for running Cython. Or we could keep 
certain "core" C modules (which are used by Cython) implemented directly 
in C.

Note that Cython is not all-or-nothing: it is easy to mix pure Python 
modules, Cython modules and pure C modules. You can also combine pure C 
code and Cython code in the same module.

Anyway, I know that this is probably not going to happen, but I just 
wanted to bring it up in case people would find it a great idea. But 
maybe not many CPython core developers actually know and use Cython?

> I would be nice to be able to use something to "generate" C
> extensions, maybe even from pure Python code.

Cython has a "pure Python mode" which does exactly that. There are 
several ways to include typing information, to ensure that a module 
remains Python-compatible but can be compiled by Cython in an optimized way.


Jeroen.


More information about the Python-Dev mailing list