Operators is
and is not
check if their operands point to the same instance, thus
they will always return respectively False
and True
when they are used to compare objects of different types.
Code examples
Noncompliant code example
a = 1
b = "1"
value = a is b # Noncompliant. Always False
value = a is not b # Noncompliant. Always True
Compliant solution
a = 1
b = 1
value = a is b
value = a is not b