diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -67,7 +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: < > <= >=' + if not roots: + raise TypeError('must define at least one ordering operation:' + '__lt__, __le__, __gt__ or __ge__ ') root = max(roots) # prefer __lt __ to __le__ to __gt__ to __ge__ for opname, opfunc in convert[root]: if opname not in roots: