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

Phil Frost indigo at bitglue.com
Sat Jun 5 06:51:44 CEST 2004


If you can think it, Python can do it. To get a feel for how it works,
take a look at http://python.org/doc/2.3.4/ext/ext.html. Using the C
API, you can make Python do anything.

However, writing all the glue can be boring and error prone, so there
are a number of tools to make this easier. Take a look at
http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/ and
http://swig.sourceforge.net/ for ideas.

On Fri, Jun 04, 2004 at 11:24:38PM -0500, Bo Peng wrote:
> Dear Python group:
> 
> I am planning on an application that involves several complicated C++ 
> classes. Basically, there will be one or two big data objects and some 
> "action" objects that can act on the data. I would like to use a script 
> language to control the interaction between these c++ objects.
>
> [snip]
> 
> I am totally new to Python. I have read boost.python, python extension 
> document but still do not know exactly what to do. My questions are:
> 
> 1. can Python fully read/write member data and run member functions of 
> my objects?
> 
> 2. can python pass complicated objects (TAction) to another object (TData)?
> 
> 3. If python can not do this, I will have to create my own scripting 
> language. Given the above pseudo code, any suggestion on how to 
> implement it? I have googgled Qt Script for Application and many other 
> weird implementations but I either do not like the grammar of the script 
> language or the huge overheads.
> 
> Many thanks in advance.
> 
> Bo




More information about the Python-list mailing list