diff options
author | Raymond Hettinger <python@rcn.com> | 2010-04-10 16:57:36 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2010-04-10 16:57:36 (GMT) |
commit | 4e45512de2d76e0366c5e7ac5d02119419bfc9ea (patch) | |
tree | ab57774a29aba30e9e5b6e294cc4dc87cfec7e0c /Lib | |
parent | 55b21389ef6f6f535dd04b710605ba3b605f7c3a (diff) | |
download | cpython-4e45512de2d76e0366c5e7ac5d02119419bfc9ea.zip cpython-4e45512de2d76e0366c5e7ac5d02119419bfc9ea.tar.gz cpython-4e45512de2d76e0366c5e7ac5d02119419bfc9ea.tar.bz2 |
Issue 8361: Remove assert from functools.total_ordering
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/functools.py | 5 |
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 |