Multiple interpreters in a single process

Aahz aahz at pythoncraft.com
Wed Jan 14 17:38:47 CET 2004


In article <btbso8$etl$1 at atlantis.news.tpi.pl>,
Maciej Sobczak  <no.spam at no.spam.com> wrote:
>
>I'm interested in embedding the Python interpreter in a C++ application.
>What I miss is the possibility to create many different interpreters, so 
>that the stuff that is running in one interpreter does not influence the 
>other. In essence, the interpreter can be used in different modules of a 
>single application. It would be nice to isolate them.

Unfortunately, it's not really possible to do that.  The problem is that
Python is designed to interface to C libraries, many of which use global
static variables.  So Python doesn't really try to allow isolated Python
instances.  Your best bet if you need true isolation is to run multiple
processes.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

A: No.
Q: Is top-posting okay?



More information about the Python-list mailing list