
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
What are different Identity operators types in Python?
Each Python object is assigned a unique identification number when it is stored in memory. It can be fetched by id() function.
The is operator compares id() of two objects and returns True if both objects have same value otherwise it returns false.
The is not operator on the other hand returns false if id() of objects is same and true otherwise. Following piece of interpreter activity will show the behaviour −
>>> a = 10 >>> b = a >>> id(a), id(b) (1581561184, 1581561184) >>> a is b True >>> a is not b False >>> a = 10 >>> b = 20 >>> id(a), id(b) (1581561184, 1581561504) >>> a is b False >>> a is not b True
- Related Articles
- What are different assignment operators types in Python?
- What are different bitwise operators types in Python?
- What are different basic operators in Python?
- What are different arithmetic operators in Python?
- Different types of operators in C++
- What are different types of quotes in Python?
- What types of logical operators are in javascript?
- What is different in & and AND operators in Python?
- What is different in | and OR operators in Python?
- What are boolean operators in Python?
- What is different in OR and AND operators in Python?
- What are different operators and expressions used in C language?
- What are different Perl Data Types?
- What are different types of interrupts?
- What are Different Types of Testing?

Advertisements