I have a legacy C library that creates a tree of objects. I would like to convert the tree into a pre-existing Python class. How do I create the PyObject for that class?
A:
If you're looking to create a python module, which can access your c code, you want to read up on Extending and Embedding the python interpreter.
JimB
2008-12-19 15:22:06
+3
A:
Cython is capable of doing this. It's a semi-fork of Pyrex, and it can wrap existing data structures and expose them to Python. In fact, this is one of the sections in the user guide. Cython is relatively easy to use, and it includes an HTML-output format that shows all the generated code as well as highlighted hot spots where optimization could be applied.
Matt
2008-12-26 04:46:59
I agree. I've had good success with Cython.
Brian Clapper
2009-01-10 19:11:07