Skip to content
Built-in Functions

id()

Return an object's identity number during this run.

id(object)

id() identifies a particular object while the program is running. It is useful for checking whether two names refer to the same object, not for storing a permanent identifier.

Parameters

NameDescription
objectThe object whose identity to inspect.

Returns

An integer unique for the object during its lifetime in this Python run.

Try it

Run it and change it
item = []
same_item = item
print(id(item) == id(same_item))

Related entries