[pypy-dev] Python FFI

Armin Rigo arigo at tunes.org
Tue May 15 18:34:10 CEST 2012


Hi Yury,

On Tue, May 15, 2012 at 5:56 PM, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
> While I don't like some design quirks of Cython, I think that it's far
> better than any ffi or ctypes-like solution.  Essentially, it's an ffi
> merged with the language, not a separate module.  And that's a pretty
> unique approach.  Why not focus on improving Cython design and moving
> toward some superset of Python language, that every implementation
> should support natively?

I'm quite sure it will never happen.  See for example the new section
"Pure Python Mode" in http://docs.cython.org/src/tutorial/pure.html:
it is again about adding ffi-like glue to Python files.  It is a
reasonable next step in the Cython project, but it shows precisely
that there is no chance to add all of Cython into the Python language
definition.

If I got you correctly, such ffi-like glue code is the part that you
dislike.  I agree with you, but I don't think we can hope for a
solution with no glue at all; instead, we can try to minimize it as
much as possible.  I may be wrong, but until proven otherwise, I am
under the impression that LuaJIT's approach leads to significantly
less glue code than Cython's Pure Python Mode.  (This is true even
though the former is complete and the latter so far not: from the
Cython docs, "A limited attempt is made to emulate these more complex
types, but only so much can be done from the Python language.")


A bientôt,

Armin.


More information about the pypy-dev mailing list