Message413628
For whatever reason, all builtins with a __bool__ method appear to share the same docstring. For example,
>>> range.__bool__.__doc__
'self != 0'
>>> bool(range(0))
False
>>> bool(range(1))
True
The concrete collection classes have their lengths stored internally so bool use that via len(self). But len(range) != 0 iff stop != start. |
|
Date |
User |
Action |
Args |
2022-02-21 02:36:33 | terry.reedy | set | recipients:
+ terry.reedy, JelleZijlstra |
2022-02-21 02:36:33 | terry.reedy | set | messageid: <1645410993.28.0.613371860137.issue46732@roundup.psfhosted.org> |
2022-02-21 02:36:33 | terry.reedy | link | issue46732 messages |
2022-02-21 02:36:33 | terry.reedy | create | |
|