Can python control complicated classes/objects written in C++

Bo Peng bpeng at
Sat Jun 5 19:40:05 CEST 2004

> I am planning on an application that involves several complicated C++ 
> classes. ... I would like to use a script
> language to control the interaction between these c++ objects.

Thank you all for the good (and quick) suggestions. I have read more 
about Python extension (SWIG, especially Dr. Beazley's tutorial) and 
boost.Python. It seems that Python/C++ is the way to do.

1. I have to use C++ since efficiency is at very high priority.

2. Writing a prototype in Python is a very good idea. Since I am more 
proficient in C++ than in Python, I am not sure which way is quicker for 
me. I will read more about Python and decide.

3. SWIG can provide tcl, perl interfaces as well. However, perl's OOP 
features seem to be weird and tcl's syntax is kind of old (personal 
opinions). Python's integration with C++ is better and the syntax is 
more natural.

4. Boost.python and SWIG are similar but SWIG is easier to use. I will 
try SWIG first.

5. My C++ code will use a lot of functors (passing objects that have 
operator() ), templates, inheritance. I hope SWIG/Python can handle all 
of them...  I am not sure if Python/SWIG can handle copy constructor 
transparently either. I am reading the documents.

Again, thank you all for the help.

More information about the Python-list mailing list