diff options
| author | Georg Brandl <georg@python.org> | 2009-03-15 21:37:16 +0000 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2009-03-15 21:37:16 +0000 |
| commit | 2108c1e170013649fc46ca895479e320cfda208b (patch) | |
| tree | ad4bd72c10576ab7d55fa57653d58ec5e8eec8c2 /Doc/reference | |
| parent | 68fee95946453a3c1bc6e021fb77ef3f6121fab5 (diff) | |
| download | cpython-2108c1e170013649fc46ca895479e320cfda208b.tar.gz | |
#5493: clarify __nonzero__ docs.
Diffstat (limited to 'Doc/reference')
| -rw-r--r-- | Doc/reference/datamodel.rst | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index d083af518e..0c1a10e663 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) |
