On Mon, Jul 30, 2018 at 09:21:01AM -0600, Mats Wichmann wrote:

> (id does not necessarily mean memory location, by the way)

id() *never* means memory location in Python. id() *always* returns an 
opaque integer ID number which has no promised meaning except to be 
unique while the object is alive.

The interpreter has to generate an ID somehow. In Jython and IronPython, 
the interpreter keeps a counter, and IDs are allocated as consecutive 
numbers 1, 2, 3, 4, ... etc. In CPython, the object's memory address is 
used to generate the ID, but the ID does not mean "memory address". If 
the ID happens to match the memory address, that's an accident, not a 
feature of the language.


-- 
Steve
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to