
- 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 does 'is not' operator do in Python?
In Python, is and is not operators are called identity operators. Each object in computer's memory is assigned a unique identification number (id) by Python interpreter. Identity operators check if id() of two objects is same. 'is not' operator returns true of id() values are different and false if they are same.
>>> a=10 >>> b=a >>> id(a), id(b) (490067904, 490067904) >>> a is not b False >>> a=10 >>> b=20 >>> id(a), id(b) (490067904, 490068064) >>> a is not b True
- Related Articles
- What does 'not in' operator do in Python?
- What does 'is' operator do in Python?
- What does the &= operator do in Python?
- What does the >> operator do in Python?
- What does 'in' operator do in Python?
- What does colon ':' operator do in Python?
- What is "is not" operator in Python?
- What is "not in" operator in Python?
- What Does the // Operator Do?
- What does "?:" do in Kotlin? (Elvis Operator)
- What does the "===" operator do in Kotlin?
- What does the Star operator mean in Python?
- What does the bitwise left shift operator do in Java?
- What does the bitwise right shift operator do in Java?
- What is the !! (not not) operator in JavaScript?

Advertisements