The Python documentation for the id()
function says
id(object) Return the “identity” of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same id() value.
So, practically, it guaranties the uniqueness as an hash function, but only within the object lifespan and without the cool thing that an hash is hardly reconstructable.
Why should one use id()
?