Bugs item #1730322, was opened at 2007-06-03 13:10 Message generated for change (Comment added) made by collinwinter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1730322&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Type/class unification Group: Python 2.5 >Status: Closed >Resolution: Wont Fix Priority: 5 Private: No Submitted By: L. Peter Deutsch (lpd) Assigned to: Nobody/Anonymous (nobody) Summary: getattr([], '__eq__')(some-object) is NotImplemented Initial Comment: Consider: a = [] class B: pass class C(object): pass print a == B() print a == C() m = getattr(a, '__eq__') print m(B()) print m(C()) I think this should print 'False' 4 times, but it actually prints: False False NotImplemented NotImplemented If this isn't a bug, please explain why. ---------------------------------------------------------------------- >Comment By: Collin Winter (collinwinter) Date: 2007-06-05 14:23 Message: Logged In: YES user_id=1344176 Originator: NO This isn't a bug because a.__eq__() isn't the whole story on equivalence testing. NotImplemented is a perfectly valid return value for a comparison method; in this case, it signals the == operator to try a different approach. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1730322&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com