[Python-checkins] r46950 - python/branches/release24-maint/Doc/ref/ref5.tex

georg.brandl python-checkins at python.org
Wed Jun 14 08:29:13 CEST 2006


Author: georg.brandl
Date: Wed Jun 14 08:29:13 2006
New Revision: 46950

Modified:
   python/branches/release24-maint/Doc/ref/ref5.tex
Log:
Bug #1501122: mention __gt__ &co in description of comparison order.
 (backport from rev. 46949)

Modified: python/branches/release24-maint/Doc/ref/ref5.tex
==============================================================================
--- python/branches/release24-maint/Doc/ref/ref5.tex	(original)
+++ python/branches/release24-maint/Doc/ref/ref5.tex	Wed Jun 14 08:29:13 2006
@@ -908,7 +908,10 @@
 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
@@ -953,7 +956,8 @@
   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.


More information about the Python-checkins mailing list