Python, C++ interaction

Christian Gollwitzer auriocus at gmx.de
Thu Dec 4 03:49:01 EST 2014


Am 03.12.14 09:29, schrieb Michael Kreim:
> I did some googleing on extending Python by C++ code but I did not find
> something that satisfies me. I gave SWIG a try, but several webpages
> disadvised me of using it. Also my small experiments did not work.

I don't know why SWIG is discouraged; in my experience, it is a very 
easy way to generate the wrapping code around C++ classes, and also 
flexible in many directions. It can be easily extended for new datatypes 
(there is a numpy interface module, for instance), and also generates 
code for other scripting languages as well. What specifically did you 
try, and what failed?

Concerning the callbacks, I don't know about these, but hopefully you 
are aware that you can easily loose the C++ speed advantage by using 
Python lambdas, since those have to go through the Python interpreter.

	Christian




More information about the Python-list mailing list