On Aug 14, 1:18 pm, ariel ledesma <[EMAIL PROTECTED]> wrote: > hello guys > > i just ran into this when comparing negative numbers, they start > returning False from -6 down, but only when comparing with 'is' > > >>> m = -5 > >>> a = -5 > >>> m is a > True > >>> m = -6 > >>> a = -6 > >>> m is a > False > >>> m == a > True > > i read that 'is' compares if they are really the same object, but i > don't that's it because then why does -5 return True? > of course i could only use == to compare, but still, what am i missing here? > thanks in advance > > ariel
strange, I get the same thing. >From the docs The operators is and is not test for object identity: x is y is true if and only if x and y are the same object. x is not y yields the inverse truth value. so: >a = b = -6 >a is b True It is odd behaviour, but I would stick to '==' when comparing numeric values -- http://mail.python.org/mailman/listinfo/python-list