469,275 Members | 1,599 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

allocate TWO interpreters in a C program?

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.

Jul 18 '05 #1
2 1063
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
da***@dalkescientific.com
Jul 18 '05 #2
In article <4V*******************@newsread1.news.pas.earthlin k.net>, Andrew Dalke wrote:
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
da***@dalkescientific.com


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
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Johan Fredrik Ohman | last post: by
1 post views Thread by Maciej Sobczak | last post: by
2 posts views Thread by bmatt | last post: by
37 posts views Thread by Curt | last post: by
4 posts views Thread by Franklin Lee | last post: by
20 posts views Thread by ramasubramanian.rahul | last post: by
3 posts views Thread by Marcin Kalicinski | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.