Robert Schuppenies <robert.schuppen...@gmail.com> added the comment:
Maybe because I take the doc too specfic. It says "A rich comparison method may return the singleton NotImplemented if it does not implement the operation for a given pair of arguments." I see the type check of the 'other' object as an operation towards the equal comparison, since it validates wether 'self' and 'other' can be equal at all. If they are of a different type, then they cannot be equal, thus the anwser to "Are 'self' and 'other' equal?" should be False. This again, would mean an equal operation is implemented and returning NotImplemented is not the right anwser. But going through similar code snippets shows otherwise, so my understanding must be lacking something. Therefore here is patch which returns NotImplemented. ---------- Added file: http://bugs.python.org/file13989/_weakrefset-notimplemented.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5964> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com