Finding the instance reference of an object [long and probably boring]

Steve Holden steve at holdenweb.com
Tue Nov 11 09:00:03 EST 2008


greg wrote:
> Arnaud Delobelle wrote:
>> But in the course of conversation I might refer to
>> Napoleon, meaning Napoleon Bonaparte (1769 - 1821) or Napoleon III (1808
>> - 1873).
> 
> That's more like referring to the name 'Napoleon' in
> two different namespaces. The original binding still
> exists, you're just switching contexts.
> 
>> My point was to get away from a model for Python which was built on its
>> likely implementation and to hint that we can build one using the naive
>> concept of 'name for a thing' instead.
> 
> I don't believe it's possible to build any complete and
> correct model of Python behaviour without including some
> concept equivalent to a reference.
> 
> You can talk about names written on PostIt notes and
> such like, but that only gets you a short way. It doesn't
> easily handle names in different namespaces, or references
> that exist without simple names, e.g. list and tuple
> items. Trying to repair these deficiencies only leads to
> increasingly bizarre and contrived mental pictures.
> 
+1

> On the other hand, if you explicitly include the concept
> of a reference from the beginning, everything is quite
> clear and consistent.
> 
Yes. References do explain things very well, since the model is in exact
agreement with the reality of the implementation.

> In other words, the model should be as simple as possible
> but no simpler. Leaving out references makes it too
> simple.
> 
> Another point I'd like to make is that there is nothing
> inherently low-level about the concept of a reference.
> It doesn't have to be implemented as a memory address or
> any other particular machine-level thing. It's possible to
> talk about Python object references in a completely
> implementation-independent way.
> 
Indeed one might make use of some object store, and references would
still be useful even if they weren't memory addresses.

> Also, just because you don't explicitly refer to them and
> manipulate them at the language level doesn't mean they
> don't exist. To think otherwise is like thinking that air
> doesn't exist just because you can't see it. There are
> plenty of experiments which clearly indicate its existence.
> Likewise, there are plenty of experiments that you can
> perform with any Python interpreter that reveal the
> existence of references, or something equivalent to them.
> 
Good stuff. I have come to the conclusion that this thread is mostly
best left alone, since the remaining participants appear to have agreed
on Python's semantics and now continue to argue about what name should
be used to describe them.

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