From: Raymond Hettinger Date: Sat, 10 Apr 2010 16:59:03 +0000 (+0000) Subject: Issue 8361: Remove assert from functools.total_ordering X-Git-Tag: v3.2a1~1197 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=56de7e2a367e1a2deef28faec62077b43d4240f6;p=python Issue 8361: Remove assert from functools.total_ordering --- diff --git a/Lib/functools.py b/Lib/functools.py index 539dc90ecd..d75e44ae83 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