summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-03-15 21:37:16 (GMT)
committerGeorg Brandl <georg@python.org>2009-03-15 21:37:16 (GMT)
commit3259ef3dff534dd0c106905ffa6e14d8fe7181e1 (patch)
tree67d9e00eeda879262aad0b5216fec720c6f6fefa
parent4c95e091d6bfb7b2686ebe2d715ae38f65d3eb8b (diff)
downloadcpython-3259ef3dff534dd0c106905ffa6e14d8fe7181e1.zip
cpython-3259ef3dff534dd0c106905ffa6e14d8fe7181e1.tar.gz
cpython-3259ef3dff534dd0c106905ffa6e14d8fe7181e1.tar.bz2
#5493: clarify __nonzero__ docs.
-rw-r--r--Doc/reference/datamodel.rst9
1 files changed, 5 insertions, 4 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index d083af5..0c1a10e 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -1424,11 +1424,12 @@ Basic customization
.. index:: single: __len__() (mapping object method)
- Called to implement truth value testing, and the built-in operation ``bool()``;
+ Called to implement truth value testing and the built-in operation ``bool()``;
should return ``False`` or ``True``, or their integer equivalents ``0`` or
- ``1``. When this method is not defined, :meth:`__len__` is called, if it is
- defined (see below). If a class defines neither :meth:`__len__` nor
- :meth:`__nonzero__`, all its instances are considered true.
+ ``1``. When this method is not defined, :meth:`__len__` is called, if it is
+ defined, and the object is considered true if its result is nonzero.
+ If a class defines neither :meth:`__len__` nor :meth:`__nonzero__`, all its
+ instances are considered true.
.. method:: object.__unicode__(self)