Message400196
Truth testing states that "Any object can be tested for truth value" but from 3.9 onwards, doing so with NotImplemented is deprecated and will be made a TypeError.
https://docs.python.org/3/library/stdtypes.html#truth-value-testing
It is also not true for third-party objects such as numpy arrays (which raise ValueError) and pandas dataframes.
I think that truth testing should have been considered a fundamental operation that (in the absence of bugs) always succeeds, but #35712 says different. Not that I'm bitter *wink*
In any case, at the very least the exception for NotImplemented should be documented. |
|
Date |
User |
Action |
Args |
2021-08-24 03:33:20 | steven.daprano | set | recipients:
+ steven.daprano, docs@python |
2021-08-24 03:33:20 | steven.daprano | set | messageid: <1629776000.21.0.00803055274817.issue44989@roundup.psfhosted.org> |
2021-08-24 03:33:20 | steven.daprano | link | issue44989 messages |
2021-08-24 03:33:20 | steven.daprano | create | |
|