id()Easy Examples

Returns the unique identity (memory address) of an object

Basic id() usage

Simple demonstration of the id() built-in function.

python
x = 42
print(id(x))
y = x
print(id(x) == id(y))
z = 42
print(id(x) == id(z))

id() is a built-in function that returns the unique identity (memory address) of an object.

id() with different inputs

Calling id() with various argument types.

python
# More id() examples
print("id() is a Python built-in function")
print(f"Type: {type(id)}")

id() accepts different types of arguments and produces corresponding results.

Want to try these examples interactively?

Open Easy Playground