# comparing use of == (value comparison) with is (reference comparison) # for numbers it is the same thing >>> a = 7 >>> b = 7 >>> a == b Out[1]: True >>> a is b Out[1]: True # for strings, which are immutable, it depends on the system you are using :( # in Eclipse >>> a = 'abc' >>> b = 'abc' >>> a == b Out[1]: True >>> a is b Out[1]: True >>> b = 'a' + 'b' + 'c' >>> a is b Out[1]: True >>> a = 'aaa' >>> b = 'a' * 3 >>> a is b Out[1]: True # in Cloudcoder >>> a = 'abc' >>> b = 'abc' >>> a == b Out[1]: True >>> a is b Out[1]: True >>> b = 'a' + 'b' + 'c' >>> a is b Out[1]: False >>> a = 'aaa' >>> b = 'a' * 3 >>> a is b Out[1]: False # for lists, which are mutable, they are two very different things >>> l = [ 1, 2, 3 ] >>> l2 = [ 1, 2, 3 ] >>> l3 = l >>> l == l2 Out[1]: True >>> l is l2 Out[1]: False >>> l is l3 Out[1]: True >>> l2 is l3 Out[1]: False >>> l3.append(4) >>> l [ 1, 2, 3, 4 ] >>> l[0] = 0 >>> l3 [ 0, 2, 3, 4 ]