Issue 8361: Remove assert from functools.total_ordering

This commit is contained in:
Raymond Hettinger 2010-04-10 16:59:03 +00:00
parent c075f07a97
commit 56de7e2a36
1 changed files with 3 additions and 2 deletions

View File

@ -67,7 +67,8 @@ 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: < > <= >='
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: