Skip to content

Commit c1eb09e

Browse files
rhettingerGadgetSteve
authored andcommitted
Conceptually, roots is a set. Also searching it as a set is a tiny bit faster (python#3338)
1 parent e51c85d commit c1eb09e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/functools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def _lt_from_ge(self, other, NotImplemented=NotImplemented):
193193
def total_ordering(cls):
194194
"""Class decorator that fills in missing ordering methods"""
195195
# Find user-defined comparisons (not those inherited from object).
196-
roots = [op for op in _convert if getattr(cls, op, None) is not getattr(object, op, None)]
196+
roots = {op for op in _convert if getattr(cls, op, None) is not getattr(object, op, None)}
197197
if not roots:
198198
raise ValueError('must define at least one ordering operation: < > <= >=')
199199
root = max(roots) # prefer __lt__ to __le__ to __gt__ to __ge__

0 commit comments

Comments
 (0)