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

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.

2018-07-31 14:01 GMT+02:00 Jeroen Demeyer <J.Demeyer@ugent.be>:
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 know that Yury wants to use Cython for "C extensions" of CPython. Victor

On Tue, Jul 31, 2018 at 7:35 AM Victor Stinner <vstinner@redhat.com> wrote:
2018-07-31 14:01 GMT+02:00 Jeroen Demeyer <J.Demeyer@ugent.be>:
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 know that Yury wants to use Cython for "C extensions" of CPython.
FWIW, Brett, Barry, and I were discussing the (small) possibility of adding a minimal tool based on Cython to the repo. I've opened a thread about this on capi-sig. Replies there, please. -eric

Jeroen Demeyer schrieb am 31.07.2018 um 14:01:
On 2018-07-31 12:56, Victor Stinner wrote:
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.
FWIW, modules like difflib can easily be speed up by factors when compiling and optimising them with Cython, without giving up the Python syntax compatibility. I just gave a Cython talk at EuroPython last week where I used difflib as one of my examples. Stefan
participants (4)
-
Eric Snow
-
Jeroen Demeyer
-
Stefan Behnel
-
Victor Stinner