4 ms·
cffi's API is similar to LuaJIT's, so if you're familiar and comfortable with that, then cffi might be a good option. If you're looking at creating your whole
by jnbiche 13y ago
cffi's API is similar to LuaJIT's, so if you're familiar and comfortable with that, then cffi might be a good option.
If you're looking at creating your whole application around C extensions for Python, as in the case with some Cython apps, then libffi might be a good alternative. I've never used it, so I can't make any empirical observations about cffi (unlike Cython, which I've used -- it's awesome).
The great thing about all these newish ways to interface with C code in Python is that we no longer have to write Python extensions in C. I like C, but writing Python extensions in C was very painful and tedious for me. So all these options are a good thing.
Otherwise, I think ctypes is a more convenient option (it's always available, no extra installations required). Also, the ctypes API is much more Pythonic, in my opinion.
- untothebreach 13y agoThanks for the thoughts!