[pypy-dev] Python FFI

Armin Rigo arigo at tunes.org
Sun May 27 17:54:47 CEST 2012


Hi Laura,

On Wed, May 23, 2012 at 6:29 AM, Laura Creighton <lac at openend.se> wrote:
> tons of things that I agree with more or less wholesale, though I think
> that there is a slightly larger market for Cython in the immediate
> future ...

Sure, I never meant to give any market size estimate.

> Sounds great to me.  Except that Mike Pell (LuaJit's author) hasn't
> been cc'd  on this note.

He has shown up in #pypy to discuss it.

> Because, dear God,
> if he had not already existed and made this thing, then *we*
> would be the people with the best working FFI.

I want to emphasis here that it's done "the LuaJIT way".  I don't want
to pretend having invented anything myself.  If it were not for
LuaJIT, then very probably we would not have found this solution ---
although it seems very natural in hindsight.

> No NO NO -- our way was an experiment and too messy to be used.

Unsure what you mean here...  I've used the Python ffi interface on
some examples, and it seems both clean enough and much more natural
than packaging tons of objects that you have to learn about first.  It
is maybe as close to a no-API interface that you can get, provided you
already know Python and have a basic knowledge of C.

Example: http://bpaste.net/show/30171/   This is as close to the
original C code as possible, with a small page of C declarations
copy-pasted from the man pages.  I think that this example alone shows
that the approach really works, although it should be tried on larger
examples too.


A bientôt,

Armin.


More information about the pypy-dev mailing list