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

Paul McGuire ptmcg at austin.rr._bogus_.com
Sat Jun 5 03:22:04 EDT 2004


"Bo Peng" <bpeng at rice.edu> wrote in message
news:c9rhu6$sk6$1 at joe.rice.edu...
> 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.
>
> I become interested in Python since it can load C++ objects and can even
> extend C++ classes. However, I am not quite sure to what extent can
> python do this. Ideally, I would like to have something like
>
> (pseudo code, not in python)
>  > data = new TData( option1=..., option2=...)
>  > action1 = new TAction(option1=range(1,10)...)
>  > action2 = new TSubAction(option1=sin(5),..., option2=...)
>  > data.run( action1, action2)
>  > data.print
>
> <snip>

To follow up on Terry Reedy's comment, why are the objects in C++ at all?
Or at least, why not prototype this entirely in Python, and then use what
you've learned to architect a good solid set of C++ classes?  If the classes
are as complicated as you say, then there is a good chance that your initial
class and class interaction designs will need some refining after you get
them down in rough form.  As your design thoughts evolve about the
interfaces of the TData and TAction classes, and how they work together, you
will be much quicker at making the changes in Python.

-- Paul






More information about the Python-list mailing list