Python id() Function

❮ Built-in Functions


Example

Return the unique id of a tuple object:

x = ('apple', 'banana', 'cherry')
y = id(x)
Try it Yourself »

Definition and Usage

The id() function returns a unique id for the specified object.

All objects in Python has its own unique id.

The id is assigned to the object when it is created.

The id is the object's memory address, and will be different for each time you run the program. (except for some object that has a constant unique id, like integers from -5 to 256)


Syntax

id(object)

Parameter Values

Parameter Description
object Any object, String, Number, List, Class etc.

❮ Built-in Functions

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.