I found this (very good) summary ended in a surprising conclusion.

On 18/11/2018 12:32, Nick Coghlan wrote:
On Sun, 4 Nov 2018 at 23:33, Steven D'Aprano <st...@pearwood.info> wrote:
On Sun, Nov 04, 2018 at 11:43:50AM +0100, Stephane Wirtel wrote:
In this PR [https://github.com/python/cpython/pull/3382] "Remove reference
to
address from the docs, as it only causes confusion", opened by Chris
Angelico, there is a discussion about the right term to use for the
address of an object in memory.
Why do we need to refer to the address of objects in memory?
...
Chris's initial suggestion was to use "license number" or "social
security number" (i.e. numbers governments assign to people), but I'm
thinking a better comparison might be to vehicle registration numbers,
...
On the other hand, we're talking about the language reference here,
not the tutorial, and understanding memory addressing seems like a
reasonable assumed pre-requisite in that context.

Cheers,
Nick.
It is a good point that this is in the language reference, not a tutorial. Could we not expect readers of that to be prepared for a notion of object identity as the abstraction of what we mean by "the same object" vs "a distinct object"? If it were necessary to be explicit about what Python means by it, one could unpack the idea by its properties: distinct names may be given to the same object (is-operator); distinct objects may have the same value (==-operator); an object may change in value (if allowed by its type) while keeping its identity.

And then there is the id() function. That is an imperfect reflection of the identity. id() guarantees that for a given object (identity) it will always return the same integer during the life of that object, and a different integer for any distinct object (distinct identity) with an overlapping lifetime. We note that, in an implementation of Python where objects are fixed in memory for life, a conformant id() may return the object's address.

Jeff Allen




_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to