Combining C and Python programs

Philip Semanchuk philip at semanchuk.com
Sat Aug 29 14:46:15 EDT 2009


On Aug 29, 2009, at 3:54 AM, Sortie wrote:

> I want to write a program that will use ode for the physics
> simulation, whose python bindings are outdated. So I'm writing
> the physics engine in C and want to write the drawing code in
> Python. What will be the best way of making those two programs
> work together? THe physics engine won't have to run concurrently
> with the drawing code. It will only return some position data so
> they can be drawn.


I'd look at ctypes first, as Hendrik suggested. It's pretty simple and  
part of the standard library.

If that doesn't work for you for some reason and you're willing to use  
something outside of the standard library, you might find Cython useful.


Good luck
Philip



More information about the Python-list mailing list