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.
reblark on Dec. 10, 2019
Everything in Python is an object—is a variable an object? I know that it points to an assigned value which is an object, but is it an object?