Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > allocate TWO interpreters in a C program?

Reply
Thread Tools

allocate TWO interpreters in a C program?

 
 
Torsten Mohr
Guest
Posts: n/a
 
      04-04-2004
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.

 
Reply With Quote
 
 
 
 
Andrew Dalke
Guest
Posts: n/a
 
      04-05-2004
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
http://www.velocityreviews.com/forums/(E-Mail Removed)


 
Reply With Quote
 
 
 
 
David E. Konerding DSD staff
Guest
Posts: n/a
 
      04-05-2004
In article <4Vicc.16932$(E-Mail Removed) 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
> (E-Mail 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Allocate two objects simultaneously in multi-threading dot c. Ruby 1 04-29-2011 07:27 AM
how to dinamically allocate memory for two dimensional array? Pawel_Iks C++ 4 10-29-2006 08:11 PM
Java Interpreters-Compilers books? Hrvoje Blazevic Java 2 12-13-2004 10:52 AM
Comparing perfs of two python interpreters on the same Linux machine (for Zope) Vbfoo Bar Python 1 09-14-2004 09:52 AM
Use a Perl_Interpreter and NOT call it my_perl? Use TWO interpreters? Torsten Mohr Perl Misc 6 12-31-2003 01:56 AM



Advertisments