Finding the instance reference of an object

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Fri Nov 7 13:09:08 EST 2008


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.

Of course every copy has a list of references to other copies and time 
stamps associated with every attribute.  So when you access an attribute 
the implementation first chases all the links to the copies, and checks 
if the attribute has a newer time stamp there, so the value has to be 
copied back.  =:o)

More serious:  If you start to design distributed object oriented systems 
with call-by-sharing semantics you may end up with actually copying the 
value and propagating changes or checking for them in other copies.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list