This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author p-ganssle
Recipients p-ganssle, serhiy.storchaka, veky
Date 2019-07-26.18:10:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
@veky I can't be sure, but I think you may not understand what returning `NotImplemented` does - this makes comparisons *more* versatile, not less.

The way it works is that when Python does, for example, x == y, it will first call x.__eq__(y) and check the return value of that. If that's True or False, it will return the value, but if it's NotImplemented, it will call y.__eq__(x) and return that value, unless the value is NotImplemented. If both comparisons return NotImplemented, it falls back on the default implementation for __eq__, which I think is "x is y". For __lt__ it's different fallback behavior, but the same general idea.

Most of these changes are going from a situation where __lt__ or __eq__ was raising an exception or returning False for comparisons where the operation is not defined. This makes the distinction between "I don't know how to compare myself to that object" and "I know how to compare myself to that object and I am not equal to it".
Date User Action Args
2019-07-26 18:10:22p-gansslesetrecipients: + p-ganssle, serhiy.storchaka, veky
2019-07-26 18:10:22p-gansslesetmessageid: <>
2019-07-26 18:10:22p-gansslelinkissue37685 messages
2019-07-26 18:10:21p-gansslecreate