Home » Python id() function with Examples

Python id() function with Examples

by Online Tutorials Library

Python id() Function

Python id() function returns an identity of an object. This is an integer which is guaranteed to be unique. This function takes an argument an object and returns a unique integer number which represents identity. Two objects with non-overlapping lifetimes may have the same id() value.

Signature

Parameters

object : It is an object of which id is to be returned.

Return

It returns a unique integer number.

Let’s see some examples of id() function to understand it’s functionality.

Python id() Function Example 1

Output:

139963782059696  139963805666864  139963781994504  

Python id() Function Example 2

Output:

101  Mohan  Object id: 140157155861392  

Python id() Function Example 3

Output:

True False  False False  

Next TopicPython Set

You may also like