In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote: >Mel Wilson wrote: >> 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: >[snip] > >Hmm... maybe it only shows up with subclassing?
:) Seems 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 ... >>> class Neq(Eq): ... def __eq__(self, other): ... print "(according to Neq)" ... return False ... >>> eq,neq=Eq(),Neq() >>> eq==neq (according to Neq) False >>> neq==eq (according to Neq) False >>> Regards. Mel. -- http://mail.python.org/mailman/listinfo/python-list