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
772beaaf
Commit
772beaaf
authored
Jun 14, 2006
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #1501122: mention __gt__ &co in description of comparison order.
parent
866a5d89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
Doc/ref/ref5.tex
Doc/ref/ref5.tex
+6
-2
No files found.
Doc/ref/ref5.tex
View file @
772beaaf
...
...
@@ -907,7 +907,10 @@ The operators \code{<}, \code{>}, \code{==}, \code{>=}, \code{<=}, and
the values of two objects. The objects need not have the same type.
If both are numbers, they are converted to a common type. Otherwise,
objects of different types
\emph
{
always
}
compare unequal, and are
ordered consistently but arbitrarily.
ordered consistently but arbitrarily. You can control comparison
behavior of objects of non-builtin types by defining a
\code
{__
cmp
__}
method or rich comparison methods like
\code
{__
gt
__}
, described in
section~
\ref
{
specialnames
}
.
(This unusual definition of comparison was used to simplify the
definition of operations like sorting and the
\keyword
{
in
}
and
...
...
@@ -952,7 +955,8 @@ otherwise defined.\footnote{Earlier versions of Python used
a dictionary for emptiness by comparing it to
\code
{
\{\}
}
.
}
\item
Most other types compare unequal unless they are the same object;
Most other objects of builtin types compare unequal unless they are
the same object;
the choice whether one object is considered smaller or larger than
another one is made arbitrarily but consistently within one
execution of a program.
...
...
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