In Python, every object or variable is uniquely identified. The built-in id() function is used to identify the different objects and variables.
"The Objects are Python's speculation for data. Every data in a Python program is described by objects or by connections between objects."
All the objects have an identity, a value, and a type. The function python id() returns the "identity" of the object. The object identity is an integer that is confirmed to be unique and consistent for this object throughout its lifetime.
Once the object's id() has been created in python, it will never change throughout the lifetimes, and you might think of it as the object's address in memory. The object's identity is used to uniquely identify where this object is stored in the computer memory.
"The function of id() returns an integer representing its [the object's] identity."
Therefore, the id() function shows us the permanent address of the object in memory.
Object: It is an object in python whose id is to be returned.
It always returns a different and unique integer number.
47938335258432 (Random)
47917836558144 (Random)
|