473,411 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

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 1129
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Johan Fredrik Ohman | last post by:
Hi, I'd like to use the newest interpreter if available. I tried a little bash scripting, but with no success. Is there some easy way to check a list of possible interpreters and path, and when...
1
by: Maciej Sobczak | last post by:
Hi, 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...
2
by: bmatt | last post by:
I am trying to support multiple interpreter instances within a single main application thread. The reason I would like separate interpreters is because objects in my system can be extended with...
1
by: Craig Ringer | last post by:
Hi folks I'm a bit of a newbie here, though I've tried to appropriately research this issue before posting. I've found a lot of questions, a few answers that don't really answer quite what I'm...
37
by: Curt | last post by:
If this is the complete program (ie, the address of the const is never taken, only its value used) is it likely the compiler will allocate ram for constantA or constantB? Or simply substitute the...
4
by: Franklin Lee | last post by:
Hi All, I use new to allocate some memory,even I doesn't use delete to release them. When my Application exit, OS will release them. Am I right? If I'm right, how about Thread especally on...
20
by: ramasubramanian.rahul | last post by:
hi folks i have a peculiar problem. i have to allocate more than size_t consequtive bytes on a system . after i do a malloc .. i am unable to do a realloc because it takes size_t as a new size...
3
by: Marcin Kalicinski | last post by:
How do I use multiple Python interpreters within the same process? I know there's a function Py_NewInterpreter. However, how do I use functions like Py_RunString etc. with it? They don't take any...
7
by: skip | last post by:
This question was posed to me today. Given a C/C++ program we can clearly embed a Python interpreter in it. Is it possible to fire up multiple interpreters in multiple threads? For example: ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.