summaryrefslogtreecommitdiff
path: root/Doc/ref/ref3.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/ref/ref3.tex')
-rw-r--r--Doc/ref/ref3.tex20
1 files changed, 17 insertions, 3 deletions
diff --git a/Doc/ref/ref3.tex b/Doc/ref/ref3.tex
index d355b691c8..2056a6c78d 100644
--- a/Doc/ref/ref3.tex
+++ b/Doc/ref/ref3.tex
@@ -162,7 +162,7 @@ complex numbers:
These represent elements from the mathematical set of whole numbers.
\obindex{integer}
-There are two types of integers:
+There are three types of integers:
\begin{description}
@@ -187,6 +187,17 @@ represented in a variant of 2's complement which gives the illusion of
an infinite string of sign bits extending to the left.
\obindex{long integer}
+\item[Booleans]
+These represent the truth values False and True. The two objects
+representing the values False and True are the only Boolean objects.
+The Boolean type is a subtype of plain integers, and Boolean values
+behave like the values 0 and 1, respectively, in almost all contexts,
+the exception being that when converted to a string, the strings
+\code{"False"} or \code{"True"} are returned, respectively.
+\obindex{Boolean}
+\ttindex{False}
+\ttindex{True}
+
\end{description} % Integers
The rules for integer representation are intended to give the most
@@ -222,6 +233,7 @@ and \code{z.imag}.
\end{description} % Numbers
+
\item[Sequences]
These represent finite ordered sets indexed by non-negative numbers.
The built-in function \function{len()}\bifuncindex{len} returns the
@@ -1074,8 +1086,10 @@ wrong hash bucket).
\end{methoddesc}
\begin{methoddesc}[object]{__nonzero__}{self}
-Called to implement truth value testing; should return \code{0} or
-\code{1}. When this method is not defined, \method{__len__()} is
+Called to implement truth value testing, and the built-in operation
+\code{bool()}; should return \code{False} or \code{True}, or their
+integer equivalents \code{0} or \code{1}.
+When this method is not defined, \method{__len__()} is
called, if it is defined (see below). If a class defines neither
\method{__len__()} nor \method{__nonzero__()}, all its instances are
considered true.