Kaydet (Commit) 3259ef3d authored tarafından Georg Brandl's avatar Georg Brandl

#5493: clarify __nonzero__ docs.

üst 4c95e091
...@@ -1424,11 +1424,12 @@ Basic customization ...@@ -1424,11 +1424,12 @@ Basic customization
.. index:: single: __len__() (mapping object method) .. 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 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 ``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 defined, and the object is considered true if its result is nonzero.
:meth:`__nonzero__`, all its instances are considered true. If a class defines neither :meth:`__len__` nor :meth:`__nonzero__`, all its
instances are considered true.
.. method:: object.__unicode__(self) .. method:: object.__unicode__(self)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment