Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
4e45512d
Commit
4e45512d
authored
Apr 10, 2010
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue 8361: Remove assert from functools.total_ordering
parent
55b21389
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
Lib/functools.py
Lib/functools.py
+3
-2
No files found.
Lib/functools.py
View file @
4e45512d
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment