[C++-sig] PyEval_EvalCode

Stefan Seefeld seefeld at sympatico.ca
Wed Nov 12 16:48:41 CET 2008


Alan Baljeu wrote:
> To solve this, I intend to write as much Python as possible, to drive 
> C++ objects, so I won't have to recompile, or restart my environment. 
> (Previous use of python had a slightly different goal: use Python 
> minimally for a dynamic modeling problem) So Python code will consist 
> of interactive and non-interactive scripts. These scripts receive 
> objects, work with them, and return other objects. There are no 
> persistent Python objects. There are probably Python classes designed 
> as temporary wrappers of C++ classes.
> Steps 
> 1) Embed Python in this C++ plug-in. [Done.]
> 2) Expose C++ objects (functions and/or data) defined by the plugin to Python.
> 3) Write code in Python to create and manipulate those objects.  (exec, not eval)
> 4) Write code in C++, but only when required to make (2) easy.  (Abundant existing code may hinder my goals, and force more C++)
> 5) Develop a library of unittest methods.
>
>   

This sounds perfectly reasonable to me, FWIW.
An interesting question then is how you embed your interactive Python 
shell into the application's main event loop. But that's mainly an 
implementation detail. :-)

Regards,
       Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Cplusplus-sig mailing list