is vs == operator in python
1 min readJul 8, 2020
>>> list1 = [1,2,3]
>>> list2 = [1,2,3]
>>> list1 == list2
True
>>> list1 is list2
False
is checks for reference equality (same object or not)
== checks for equality of content
>>> list1 = [1,2,3]
>>> list2 = [1,2,3]
>>> list1 == list2
True
>>> list1 is list2
False
is checks for reference equality (same object or not)
== checks for equality of content