On 3 Apr 2006 10:37:11 -0400 in comp.lang.python, [EMAIL PROTECTED] (Roy Smith) wrote:
>Adam DePrince <[EMAIL PROTECTED]> wrote: >> It just happens that the >>logical operation >> >> (a is b ) -> (a == b ) >> >>is always True. > >Only for small values of "always". You can always do pathological >things with operators: > >class Foo: > def __eq__ (self, other): > return False > >f = Foo() >print f is f >print f == f > >frame:play$ ./is.py >True >False > >This may even be useful. What if you were trying to emulate SQL's >NULL? NULL compares false to anything, even itself. To test for >NULLness, you have to use the special "is NULL" operator. Another instance where this may be useful is IEEE-754 NaN. I don't have fpconst to verify if that's the case, but I would expect NaN is NaN to be true, but NaN == NaN to be false. Regards, -=Dave -- Change is inevitable, progress is not. -- http://mail.python.org/mailman/listinfo/python-list