[issue37980] regression when passing numpy bools to sorted(..., reverse=r)

Sebastian Berg report at bugs.python.org
Fri Aug 30 09:12:17 EDT 2019


Sebastian Berg <sebastian at sipsolutions.net> added the comment:

I applaud the stricter rules in general, as Mark noted nicely, the issue is that `__index__` is maybe a strange way to achieve that for bools (it is not like `123` is a clean bool)? `__nonzero__` coerces to bools, there is no `__bool__` to convert to bool safely.

Basically: this seems to force numpy to back down from saying that `list[np.True_]` will be invalid in the future. (And we cannot just get rid of our bools unfortunately).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37980>
_______________________________________


More information about the Python-bugs-list mailing list