How to call and execute C code in Python?

Stefan Behnel stefan_ml at behnel.de
Sun May 13 13:42:35 EDT 2012


Mark Lawrence, 13.05.2012 19:27:
> On 13/05/2012 16:58, Stefan Behnel wrote:
>> David Shi, 13.05.2012 15:25:
>>> Can anyone tell me how to call and exectute C code in Python?
>>
>> Take a look at Cython, a Python-like language that supports native calls to
>> and from C/C++ code. It translates your code into very efficient C code, so
>> the wrapping code tends to be very fast (often faster than hand written C
>> code).
>>
>> http://cython.org/
>>
>> Here are a couple of examples:
>>
>> http://docs.cython.org/src/tutorial/external.html
>>
>> There's also the "ctypes" package in the standard library, which is usable
>> for simple wrapping cases that are not performance critical.
> 
> Stefan, you appear to have a lot to do with Cython. It would be polite to
> mention this when replying.

Well, my name is pretty far up both on the project home page and on PyPI,
so it's not like I'm hiding this information. But sure, I'm one of the core
developers and initial founders of the project. So I can assure you that I
know what I'm talking about.

Stefan




More information about the Python-list mailing list