In <[EMAIL PROTECTED]>, Sybren Stuvel wrote: > Dan Bishop enlightened us with: >>>>> a = b = 1e1000 / 1e1000 >>>>> a is b >> True >>>>> a == b >> False > > If "a is b" then they refer to the same object, hence a == b. It > cannot be otherwise, unless Python starts to defy logic. I copied your > code and got the expected result: > >>>> a = b = 1e1000 / 1e1000 >>>> a is b > True >>>> a == b > True
I get the same as Dan: In [13]: a = b = 1e1000 / 1e1000 In [14]: a is b Out[14]: True In [15]: a == b Out[15]: False In [16]: a Out[16]: nan On my platform the division results in "Not A Number". Two NaNs compared are always `False`. You could argue that this is the very same NaN but to get this effect the interpreter has to take care that every NaN produced while a program is running is unique. Quite huge overhead for such a corner case IMHO. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list