summaryrefslogtreecommitdiffstats
path: root/Lib/functools.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2010-04-10 16:59:03 (GMT)
committerRaymond Hettinger <python@rcn.com>2010-04-10 16:59:03 (GMT)
commit56de7e2a367e1a2deef28faec62077b43d4240f6 (patch)
treef2ff20878166f1942fc7684bfea7448a9b94a696 /Lib/functools.py
parentc075f07a97e6413c4287ffde081900b675611372 (diff)
downloadcpython-56de7e2a367e1a2deef28faec62077b43d4240f6.zip
cpython-56de7e2a367e1a2deef28faec62077b43d4240f6.tar.gz
cpython-56de7e2a367e1a2deef28faec62077b43d4240f6.tar.bz2
Issue 8361: Remove assert from functools.total_ordering
Diffstat (limited to 'Lib/functools.py')
-rw-r--r--Lib/functools.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/functools.py b/Lib/functools.py
index 539dc90..d75e44a 100644
--- a/Lib/functools.py
+++ b/Lib/functools.py
@@ -67,8 +67,9 @@ def total_ordering(cls):
('__lt__', lambda self, other: not self >= other)]
}
roots = set(dir(cls)) & set(convert)
- assert roots, 'must define at least one ordering operation: < > <= >='
- root = max(roots) # prefer __lt __ to __le__ to __gt__ to __ge__
+ if not roots:
+ raise ValueError('must define at least one ordering operation: < > <= >=')
+ root = max(roots) # prefer __lt__ to __le__ to __gt__ to __ge__
for opname, opfunc in convert[root]:
if opname not in roots:
opfunc.__name__ = opname