Pointer or unique id

Terry Reedy tjreedy at udel.edu
Sat Jan 15 14:23:39 EST 2005

"Bruno Desthuilliers" <bdesth.quelquechose at free.quelquepart.fr> wrote in 
message news:41e94d40$0$29202$636a15ce at news.free.fr...
>id(object) -> integer
>Return the identity of an object.  This is guaranteed to be unique among 
>simultaneously existing objects.

This is part of the language specification.  Also, the identity of an 
object must remain the same for its entire lifetime.

>  (Hint: it's the object's memory address.)

This is an implementation detail of CPython.  It cannot be true if the 
garbage collector moves objects around.  Or if the object lives elsewhere 
(and is accessed thru a proxy).

Terry J. Reedy

More information about the Python-list mailing list