Globals, Locals Dictionaries + Callbacks Question
Steve Holden
steve at holdenweb.com
Thu Dec 22 03:27:07 EST 2005
Faisal Alquaddoomi wrote:
> Steve Holden wrote:
>
>>Faisal Alquaddoomi wrote:
>>
>>
>>>Hello,
>>>
>>>I'm having a bit of trouble isolating my scripts from each other in my
>>>embedded Python interpreter, so that their global namespaces don't get
>>>all entangled.
>>
>>
>>[tales of woe ...]
>>
>>Would it help to use PyNewInterpreter to create subinterpreters for each
>>of the different scripts?
>>
>>regards
>> Steve
>
>
> That sounds like a reasonable suggestion, but would it be inefficient to
> spawn a whole new interpreter for each script, where what I really want
> to do is just change the dictionaries used for globals and locals? I'll
> try that out for now, but I'm still hoping there's some way to change
> those dictionaries without having to do anything excessive.
>
I guess only benchmarking can answer that question. However, given that
the code will be common to all instances you may find that it isn't too
resource-intensive. I agree it does seem much more heavyweight than
replacing execution context.
Good luck!
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
More information about the Python-list
mailing list