if i == j: # Do something if i is j: # Do something
== operator checks the values behind the two names. It returns True if the two values are equal, False otherwise.
is operator checks the objects behind the two names. It returns True if both the names refer to the same object, False otherwise.
Tried with: Python 3.2