allocate TWO interpreters in a C program?

T

Torsten Mohr

Hi,

i can embed Perl into a C program and allocate MORE THAN ONE
interpreter if i want to. They are independent from each other.

Is this also possible in Python?


Best regards,
Torsten.
 
A

Andrew Dalke

Torsten Mohr:
i can embed Perl into a C program and allocate MORE THAN ONE
interpreter if i want to. They are independent from each other.

Is this also possible in Python?

As no one else has answered, I'll take a stab at it, on the assumption
that a wrong answer will be corrected.

No, it isn't possible. Various bits of state, like exceptions, are stored
in global variable (actually thread global I think). I think there is other
global state, like sys.modules which contains all of the imported modules.

There are experimental systems like PyPy which can provide
independent interpreters but I know little about them.

Andrew
(e-mail address removed)
 
D

David E. Konerding DSD staff

Torsten Mohr:

As no one else has answered, I'll take a stab at it, on the assumption
that a wrong answer will be corrected.

No, it isn't possible. Various bits of state, like exceptions, are stored
in global variable (actually thread global I think). I think there is other
global state, like sys.modules which contains all of the imported modules.

There are experimental systems like PyPy which can provide
independent interpreters but I know little about them.

Andrew
(e-mail address removed)

Actually, more than one *sub*-interpreter can be instantiated in a single C program.

http://python.org/doc/current/api/initialization.html

However, upon close reading, it's hardly as independent as you might hope.

But for fun also read:

http://www.python.org/peps/pep-0311.html

since it seems to imply that multiple subinterpreters are not a frequently used feature.

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top