Raymond Hettinger added the comment:
This case was supposed to be covered by the last bullet point, "instances of
user-defined classes, if the class defines a __bool__() or __len__() method,
when that method returns the integer zero or bool value False.". The word
"user-defined" should be dropped.
Also, the whole section can be simplified to something like:
"""
By default, objects are considered true unless they define either a __bool__
method that returns False or __len__ method that returns zero.
Practically, this means that empty containers are false (such as [], (), {},
'', etc) and that numbers equal to zero are false (such as 0, 0.0, 0.0j, False,
Decimal(0), Fractions(0, 1), etc). Also, *None* is a false value.
"""
----------
assignee: docs@python -> rhettinger
nosy: +rhettinger
priority: normal -> low
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue30803>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com