mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
#5493: clarify __nonzero__ docs.
This commit is contained in:
parent
4c95e091d6
commit
3259ef3dff
1 changed files with 5 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue