Python id() function
Published February 16, 2022The Python id() method returns the unique identifiers of Python objects stored in memory. In Python, each object in memory can be referred to by a unique numeric value. These distinct numerical values distinguish these objects from the others.
When an object is passed as the Python id() function parameter, the object's identity is determined. The identity is an integer that remains constant in the sense that it cannot be altered or changed.
Syntax
The simple syntax of the id() function includes:
Id(object) |
This function is assigned with only a single parameter to return the object's unique identity. The identity should be unique and should not change.
Example
integer = 5 |
Output:
ID of an Integer: 9789120 |
Article Contributed By :
|
|
|
|
267 Views |