codefire a écrit : > I thought the 'is' operator was used to identify identical objects, > whereas the '==' operator checked equality. Well, I got a surprise > here: > > IDLE 1.1.3 >>>> a = 10 >>>> b = a >>>> a is b > True >>>> a == b > True >>>> c = 10 >>>> a == c > True >>>> a is c > True > > I was NOT expecting the last statement to return True!
The answer is : Why not? Does it even matter for integers? Never use "is" on integers, always == ( and on strings too for that matter ) -- http://mail.python.org/mailman/listinfo/python-list