Creating an execution environment

Fernando Pérez fperez528 at yahoo.com
Tue Jun 25 15:24:41 EDT 2002


Juan M. Casillas wrote:

> It's posible to have multiple environments with a single python
> interpreter ? its posible to have multiple interpreters in a
> C program ? Also, I want to load chunks of code for multiple
> files, and then add the symbols to the right environment...
> 

Hola Juan,

You can use IPython if you want (http://www-hep.colorado.edu/~fperez/ipython) 
which is set up for exactly that. A single call (documented in the manual and 
supplied examples) will start an environment which looks similar to the 
normal interpreter (actually with many enhancements) but with a completely 
independent namespace. Multiple such environments can coexist either in 
parallel or embedded within one another. Since they are all python programs, 
I imagine you can just make the call from within your C code. So far I've 
only tested the embedding facilities by calling them from within other python 
programs, but I don't see any reason why making the calls from within C would 
be a problem.

Suerte!

f.



More information about the Python-list mailing list