Subject: Re: [Boost-build] Extension style
From: Anthony Foglia (AFoglia_at_[hidden])
Date: 2010-07-28 14:16:25
Juraj IvanÄiÄ wrote:
> On 26.7.2010 14:22, Vladimir Prus wrote:
>> I guess I can try to put it in a different way:
>> 1. Is there a way for a single C++ application to create several, fully
>> independent, instances of Python interpreter?
> Googling came up with this:
>> 2. It is possible, within a single instance of Python interpreter, to
>> load the same module twice, so and get two copies of global data of
>> that module?
> I think that this can be achieved with module aliases (untested):
> import module as module1
> import module as module2
No, the import statement keeps track of what was imported. It doesn't work.
In : import numpy as np1
In : import numpy as np2
In : id(np1)
In : id(np2)
You might be able to do this by digging into the import mechanics. Look
at the __import__ builtin and the imp module. But I don't think it's
supported, and not something typically done.
-- Anthony Foglia Princeton Consultants (609) 987-8787 x233
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk