How to call and execute C code in Python?

Mark Lawrence breamoreboy at yahoo.co.uk
Sun May 13 13:27:28 EDT 2012


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
>

Stefan, you appear to have a lot to do with Cython. It would be polite 
to mention this when replying.

-- 
Cheers.

Mark Lawrence.




More information about the Python-list mailing list