summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2017-09-05 16:40:44 (GMT)
committerGitHub <noreply@github.com>2017-09-05 16:40:44 (GMT)
commit15ce0bee973596f02983f39e1a1b172b91e9cdda (patch)
tree1b515fa18ae1bdbb7efe4e25504e27b84ad91fed
parent75b961869a1184895c9d5bf41a57f3c985622662 (diff)
downloadcpython-15ce0bee973596f02983f39e1a1b172b91e9cdda.zip
cpython-15ce0bee973596f02983f39e1a1b172b91e9cdda.tar.gz
cpython-15ce0bee973596f02983f39e1a1b172b91e9cdda.tar.bz2
Conceptually, roots is a set. Also searching it as a set is a tiny bit faster (#3338)
-rw-r--r--Lib/functools.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/functools.py b/Lib/functools.py
index 0873f20..23ad160 100644
--- a/Lib/functools.py
+++ b/Lib/functools.py
@@ -193,7 +193,7 @@ _convert = {
def total_ordering(cls):
"""Class decorator that fills in missing ordering methods"""
# Find user-defined comparisons (not those inherited from object).
- roots = [op for op in _convert if getattr(cls, op, None) is not getattr(object, op, None)]
+ roots = {op for op in _convert if getattr(cls, op, None) is not getattr(object, op, None)}
if not roots:
raise ValueError('must define at least one ordering operation: < > <= >=')
root = max(roots) # prefer __lt__ to __le__ to __gt__ to __ge__