Object Value vs Object Identity
In Python, every object that is created is given a number that uniquely identifies it. It is guaranteed that no two objects will have the same identifier during any period in which their lifetimes overlap. Once an object’s reference count drops to zero and it is garbage collected, then its identifying number becomes available and may be used again.
The built-in Python function
id() returns an object’s integer identifier. Using the
id() function, you can verify that two variables indeed point to the same object.
Become a Member to join the conversation.