Multiple simultaneous Python interpreters

Thomas Heller theller at python.net
Wed Mar 19 13:41:21 CET 2003


"White Flame \(aka David Holz\)" <whiteflame52 at y.a.h.o.o.com> writes:

> Hi, I'm evaluating Python as a scripting language in a project I'm defining.
> Is there any way to encapsulate the interpreter so that multiple ones can
> exist in a program?  Some would be in their own thread, some would get
> called from the same one sequentially.  However, in the docs I've read,
> there's always just been one "global" interpreter.  Not very OO for an OO
> language. ;-)

PyThreadState* Py_NewInterpreter()

    Create a new sub-interpreter. This is an (almost) totally separate
    environment for the execution of Python code.

found here:
http://www.python.org/doc/2.2/api/initialization.html#l2h-648

Thomas




More information about the Python-list mailing list