Python

Python Menu

Python

Python id() Function - Definition, Syntax, Parameters, Examples

Definition

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

All objects in Python have its own unique id. The id is assigned to the object when it is created. It 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)

Parameters

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

Examples

fruits = ('apple', 'orange', 'cherry') result = id(fruits) print(result)

Introduction

Python Basics

Python Advance

Data Science Python Tutorials

Python Functions and Methods