Pointer or unique id

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Sat Jan 15 12:12:15 EST 2005


Nomak a écrit :
> Hello,
> 
> does python have an equivalent to Java: int Object.hashCode() ?
> 

id(object) -> integer
Return the identity of an object.  This is guaranteed to be unique among 
simultaneously existing objects.  (Hint: it's the object's memory address.)

hash(obj) -> integer
Return a hash value for the object.  Two objects with the same value 
have the same hash value.  The reverse is not necessarily true, but likely.

HTH
Bruno



More information about the Python-list mailing list