Message346870
Not a bug. Both function docs say "reverse is a boolean value."
https://docs.python.org/3/library/stdtypes.html#boolean-values
says "Boolean values are the two constant objects False and True." These should be used in new code.
For compatibility with old code, CPython generally allows 0 and 1. In this case, it allows any 'integral value', but I would not necessarily expect this of other implementations.
[In general, the *Python language* docs do not document extra latitude allowed by the *CPython implementation*. So the lack thereof here is also not a bug.]
All objects without fancy trickery have a __bool__ method, either inherited from *object* or overridden. This in no way makes all such objects, including Xs, into boolean values. |
|
Date |
User |
Action |
Args |
2019-06-28 22:04:26 | terry.reedy | set | recipients:
+ terry.reedy, tim.peters, rhettinger, mark.dickinson, serhiy.storchaka, nodakai |
2019-06-28 22:04:26 | terry.reedy | set | messageid: <1561759466.24.0.981110074164.issue37427@roundup.psfhosted.org> |
2019-06-28 22:04:26 | terry.reedy | link | issue37427 messages |
2019-06-28 22:04:25 | terry.reedy | create | |
|