[Python-Dev] CFFI released (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Tue Jun 19 05:38:26 CEST 2012


On Tue, Jun 19, 2012 at 12:35 PM, Terry Reedy <tjreedy at udel.edu> wrote:

Yes, because languages have no speed, only implementations do; and yes, because when CPython really is too slow for a particular task, it can be pushed onto C. But some people (pygame, others on python-list) have reported that for their project, ctypes negates too much of the C speedup, relative to swig or similar. So it has not been quite the C wrapper generator killer that some people hoped for. (This is not to say that is not great for uses it does succeed at.)

There's also another reason ctypes hasn't taken over from Cython and SWIG: because it's entirely ABI based and doesn't look at the C header files, it loses even what little type safety C possesses.

SWIG and Cython, on the other hand, suffer from the fact that you can't just decide to wrap an arbitrary DLL on the fly without predefining an extension module, and you also can't just use C syntax to define the ABI you want to access (although SWIG actually gets pretty close in many cases).

The approach Armin and Maciej have chosen here (using C declarations to define the ABI, and supporting verification against the C headers as a separate step) looks very promising.

Cheers, Nick.

-- Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-Dev mailing list