By Hemanta Sundaray on 2021-08-29
Once an object is created in Python, it’s identity never changes.
We use the is operator to compare the identity of two objects. The id() function returns an integer (the memory address of the object) representing its identity. The integer is a unique label that never changes during the life of the object.
city_one = {'name' : 'Gurugram'}
city_two = city_one
print(city_one is city_two)
# True
print(id(city_one), id(city_two))
# 2855627537472 2855627537472