[Python-checkins] r70387 - python/trunk/Doc/reference/datamodel.rst
georg.brandl
python-checkins at python.org
Sun Mar 15 22:37:16 CET 2009
Author: georg.brandl
Date: Sun Mar 15 22:37:16 2009
New Revision: 70387
Log:
#5493: clarify __nonzero__ docs.
Modified:
python/trunk/Doc/reference/datamodel.rst
Modified: python/trunk/Doc/reference/datamodel.rst
==============================================================================
--- python/trunk/Doc/reference/datamodel.rst (original)
+++ python/trunk/Doc/reference/datamodel.rst Sun Mar 15 22:37:16 2009
@@ -1424,11 +1424,12 @@
.. 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)
More information about the Python-checkins
mailing list