Finding the instance reference of an object

Steve Holden steve at holdenweb.com
Fri Nov 7 14:26:41 EST 2008


Steven D'Aprano wrote:
> On Fri, 07 Nov 2008 11:37:28 -0500, Steve Holden wrote:
> 
>> Steven D'Aprano wrote:
>>> On Fri, 07 Nov 2008 10:50:55 -0500, Steve Holden wrote:
>>>
>>>> I am probably egregiously misunderstanding. The practical difficulty
>>>> with the "moving huge blocks of data" approach would appear to emerge
>>>> when a function that gets passed an instance of some container then
>>>> calls another function that references the same container as a global,
>>>> for example.
>>> I have no doubt whatsoever that such an implementation would be
>>> fragile, complicated, convoluted and slow. In other words, it would be
>>> terrible. But that's merely a Quality of Implementation issue. It would
>>> still be Python.
>>>
>>>
>> OK, more specifically: I don't see how changes to the copy of the
>> (structure referenced by) the argument would be reflected in the global
>> structure. In other words, it seems to involve a change of semantics to
>> me, so I think I am misunderstanding you.
> 
> What, you want me to come up with an implementation? Okay, fine.
> 
> The VM keeps a list of the namespaces that contain such "cloned" objects. 
> After each Python statement is executed, before the next one gets to run, 
> the VM runs through that list and synchronizes each object in the 
> caller's scope with the value of its clone in the function scope.
> 
> 
> 
Right, so we replace references to values with references to namespaces?

Anyway, thanks. I'm really glad you stated up-front that this was not a
practical execution scheme.

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list