diff options
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/datamodel.rst | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 2e4a776..49f2be6 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1251,11 +1251,12 @@ Basic customization .. index:: single: __len__() (mapping object method) - Called to implement truth value testing, and the built-in operation ``bool()``; - should return ``False`` or ``True``. When this method is not defined, - :meth:`__len__` is called, if it is defined (see below) and ``True`` is returned - when the length is not zero. If a class defines neither :meth:`__len__` nor - :meth:`__bool__`, all its instances are considered true. + 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, and the object is considered true if its result is nonzero. + If a class defines neither :meth:`__len__` nor :meth:`__bool__`, all its + instances are considered true. .. _attribute-access: |