[Python-Dev] cffi in stdlib

Maciej Fijalkowski fijall at gmail.com
Tue Feb 26 19:34:40 CET 2013


On Tue, Feb 26, 2013 at 8:14 PM, Paul Moore <p.f.moore at gmail.com> wrote:
> On 26 February 2013 16:34, Eli Bendersky <eliben at gmail.com> wrote:
>> I'm cautiously +0.5 because I'd really like to see a strong comparison case
>> being made vs. ctypes. I've used ctypes many times and it was easy and
>> effortless (well, except the segfaults when wrong argument types are
>> declared :-). I'll be really interesting in seeing concrete examples that
>> demonstrate how CFFI is superior.
>
> I'm probably the same, mainly because I've successfully used ctypes in
> the past, but I've never used cffi. That's something I need to
> rectify.
>
> One point which I *think* is correct, but which I don't see noted
> anywhere. Am I right that cffi needs a C compiler involved in the
> process, at least somewhere? If that's the case, then it is not a
> suitable option for at least one use case that I have, writing quick
> hacks involving the Windows API on a machine that doesn't have a C
> compiler installed. Another possible case would be writing zip-safe
> code - if cffi involves a compiled C extension, it won't work when
> loaded from a zipfile.

cffi does require a C compiler during either runtime or installation,
if you use the API. You can still use the ABI level, which is like
ctypes, only if you need the extra stuff, you need a C compiler.

>
> In general, a proper, unbiased comparison between cffi and ctypes
> would be useful.

that obviously can't come from me.


More information about the Python-Dev mailing list