Address of an immutable object

candide candide at free.invalid
Sun May 30 16:08:49 EDT 2010


Alf P. Steinbach a écrit :
> * candide, on 30.05.2010 19:38:
>> Suppose a Python program defines an integer object with value 42. The
>> object has an "address" we can capture with the built-in function id() :

> First, id() doesn't generally provide an address. 

I talked about a quote unquote "address" ;)
but according to "The Python Language Reference" it's not very far from 
the truth  :

--------------------
3.1 Objects, values and types
(...)
An object’s identity never changes
once it has been created; you may think of it as the object’s _address_ 
in memory. The ‘is‘ operator compares the
identity of two objects; the id() function returns an integer 
representing its identity (currently implemented as
its _address_).
--------------------

(emphasizing is mine)



More information about the Python-list mailing list