You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In all past versions of NumPy dating back at least a decade, using astype(bool) on a str of '0' obtained False and on any other integer as True. Now the result is always True.
Related to #9875. I'd argue that the behavior isn't logical at all, but the fact remains that we didn't intend to change this behavior in a patch release.
#15766 is the offending change in master corresponding to the backport linked at the top.
Dang, yes, booleans are so hopelessly inconsistent here, and I did not think of them, too bad we did not have tests for this :(. Aside from the point release change, which is very unfortunate...
I somewhat think we should probably just put a FutureWarning on it and change it as fast as reasonably possible. Being out of sync with ourselves and especially Python doesn't help anyone, because it seems like there may be good logic here, when the logic is just inconsistent.
Activity
eric-wieser commentedon Apr 20, 2020
Related to #9875. I'd argue that the behavior isn't logical at all, but the fact remains that we didn't intend to change this behavior in a patch release.
#15766 is the offending change in master corresponding to the backport linked at the top.
seberg commentedon Apr 20, 2020
Dang, yes, booleans are so hopelessly inconsistent here, and I did not think of them, too bad we did not have tests for this :(. Aside from the point release change, which is very unfortunate...
I somewhat think we should probably just put a
FutureWarningon it and change it as fast as reasonably possible. Being out of sync with ourselves and especially Python doesn't help anyone, because it seems like there may be good logic here, when the logic is just inconsistent.