summaryrefslogtreecommitdiffstats
path: root/Doc/ref
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-07-16 19:40:23 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-07-16 19:40:23 (GMT)
commit4d6e8fe5d13a313314550d7ebffafaf62dea1df2 (patch)
tree49ef23772420662e3c4fe760710d4387d214270d /Doc/ref
parent71adf7e9d8fb2aca563eeca806ea127409c82bb6 (diff)
downloadcpython-4d6e8fe5d13a313314550d7ebffafaf62dea1df2.zip
cpython-4d6e8fe5d13a313314550d7ebffafaf62dea1df2.tar.gz
cpython-4d6e8fe5d13a313314550d7ebffafaf62dea1df2.tar.bz2
Clarify the lack of relationship between rich comparison operators.
Prompted by a discussion on comp.lang.python.
Diffstat (limited to 'Doc/ref')
-rw-r--r--Doc/ref/ref3.tex5
1 files changed, 5 insertions, 0 deletions
diff --git a/Doc/ref/ref3.tex b/Doc/ref/ref3.tex
index 785a995..68d87b4 100644
--- a/Doc/ref/ref3.tex
+++ b/Doc/ref/ref3.tex
@@ -1089,6 +1089,11 @@ used in a Boolean context, the return value should be interpretable as
a Boolean value, else a \exception{TypeError} will be raised.
By convention, \code{False} is used for false and \code{True} for true.
+There are no implied relationships among the comparison operators.
+The truth of {\var{x}==\var{y}} does not imply that \code{\var{x}!=\var{y}}
+is false. Accordingly, when defining \method{__eq__}, one should also
+define \method{__ne__} so that the operators will behave as expected.
+
There are no reflected (swapped-argument) versions of these methods
(to be used when the left argument does not support the operation but
the right argument does); rather, \method{__lt__()} and