[issue28685] Optimizing list.sort() by performing safety checks in advance
ppperry
report at bugs.python.org
Sun Mar 12 20:35:06 EDT 2017
ppperry added the comment:
-----
Doesn't youre skipping PyObject_RichCompareBool and directly getting
tp_richcompare also mean that you bypass the NotImplemented checking?
Thus, wouldn't this code, which raises a TypeError currently, silently
work?
class PointlessComparator:
def __lt__(self, other):
return NotImplemented
[PointlessComparator(),PointlessComparator()].sort()
... ... ...
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28685>
_______________________________________
More information about the Python-bugs-list
mailing list