In article <[EMAIL PROTECTED]>,
Steven Bethard <[EMAIL PROTECTED]> wrote:
>I believe what Peter Otten was pointing out is that calling __eq__ is
>not the same as using ==, presumably because the code for == checks the
>types of the two objects and returns False if they're different before
>the __eq__ code ever gets called.

Doesn't seem to:



Python 2.3 (#46, Jul 29 2003, 18:54:32) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> class EQ(object):
...     def __eq__ (self, other):
...             return True
...
>>> eq = EQ()
>>> eq == 3
True
>>> 3 == eq
True
>>> class NEQ(object):
...     def __eq__ (self, other):
...             return False
...
>>> neq=NEQ()
>>> eq == neq
True
>>> neq == eq
False
>>>



        Regards.        Mel.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to