[Python-checkins] r79931 - python/branches/py3k/Lib/functools.py
raymond.hettinger
python-checkins at python.org
Sat Apr 10 18:59:03 CEST 2010
Author: raymond.hettinger
Date: Sat Apr 10 18:59:03 2010
New Revision: 79931
Log:
Issue 8361: Remove assert from functools.total_ordering
Modified:
python/branches/py3k/Lib/functools.py
Modified: python/branches/py3k/Lib/functools.py
==============================================================================
--- python/branches/py3k/Lib/functools.py (original)
+++ python/branches/py3k/Lib/functools.py Sat Apr 10 18:59:03 2010
@@ -67,8 +67,9 @@
('__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
More information about the Python-checkins
mailing list