First page Back Continue Last page Overview Graphics

Proof with Identity

id(object)

Returns the “identity” of an object. It is an integer (long integer), guaranteed to be unique and constant for the lifetime of this object.

Two objects with non-overlapping lifetimes may have the same id() value.

>>> x = 3

>>> y = x

>>> print(id(x))

10105888

>>> print(id(y))

10105888

>>> y = 2

>>> print(id(y))

10105856

>>> print(id(x))

10105888