[issue10042] functools.total_ordering fails to handle NotImplemented correctly
Katie Miller
report at bugs.python.org
Tue Jul 9 04:37:11 CEST 2013
Katie Miller added the comment:
Attached is a new patch, which includes Nick's logic from msg140493, some of the code readability changes Jim suggested in msg151989 (but not the behavioural changes), and associated tests. On Nick's advice, I have also replaced the dunder equals calls with the standard comparators (==/!=), given not all classes will necessarily have both NE and EQ, and made the comparison the last action in each method, for consistency.
Test cases have been added to check a TypeError is raised, rather than True being returned, when GE/LE is called on two objects that are equal but have a comparator that returns NotImplemented.
----------
Added file: http://bugs.python.org/file30871/10042_new_total_ordering_with_tests.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10042>
_______________________________________
More information about the Python-bugs-list
mailing list