mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
#6428: py3k requires that __bool__ return a bool (and not an int)
Fix the error message and the documentation.
This commit is contained in:
parent
dd07ebb44a
commit
097cd072c0
3 changed files with 11 additions and 9 deletions
|
@ -1254,11 +1254,11 @@ 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``, 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.
|
||||
``bool()``; should return ``False`` or ``True``. 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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue