Python id() built-in function

From the Python 3 documentation

Return the “identity” of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same id() value.

Introduction

The id() function returns a unique integer that identifies an object in memory. This ID is guaranteed to be unique for the lifetime of the object. It’s essentially the memory address of the object.

Examples

x = 10
y = 10
z = 20

print(id(x))
print(id(y))  # same as id(x) because Python caches small integers
print(id(z))
print(id(1))
print(id('1'))
print(id([1, 2]))
4331368528
4331368528
4331368560
4331368496
4331368560
4331368560