What is the difference between is and == in Python?
Quick answer
== checks whether two objects have equal values, while is checks whether they are the exact same object in memory.
== calls the object's __eq__ method. is compares identity (the same as comparing id(a) == id(b)). Two separate lists with the same content are == but not is.
Use is for singletons, mainly None (if x is None), True and False. Do not use is to compare numbers or strings: CPython caches small integers and some strings, so the result can look right in a quick test and fail in real code.
a = [1, 2]
b = [1, 2]
a == b # True (same value)
a is b # False (different objects)
c = a
c is a # True
if result is None:
...