Object Equality and Identity
x == y
Tests the
values
of x and y for equality
Sequences are equal if every element is equal.
Dictionaries are equal if they have the same set of keys and all objects with same key have the same value.
x is y
Tests if x and y are exactly the same object.
x is not y
Tests if x and y are different objects
Notes
x == y may be true while x is not y
Comparisons between non-compatible types may not generate an error, but the result is arbitrary (although always the same for the same two objects)
<<<
O'Reilly OSCON 2000, Introduction to Python, Slide 62
July 17, 2000, beazley@cs.uchicago.edu
>>>