Identity operators
is and is not are the identity operators in Python. They are used to check if two values (or variables) are located on the same part of the memory. Two variables that are equal does not imply that they are identical.
| Operator |
Meaning |
Example |
| is |
True if the operands are identical (refer to the same object) |
x is True |
| is not |
True if the operands are not identical (do not refer to the same object) |
x is not True |