id() Function in Python: What’s It Good For?
The id() function in Python is a built-in function that returns the unique identity of an object. This identity is an integer that is guaranteed to be unique and constant for the object during its lifetime. The id() function can be used to determine whether two variables refer to the same object in memory. This is helpful when determining the type of copy you have with two variables: if they refer to the same id() number then they are referencing the same object, on the other hand if they refer to two distinct id() numbers then while the objects may contain the same content they are different objects. ...