Message350868
> DeprecationWarning: In future, it will be an error for 'np.bool_' scalars to be interpreted as an index
That sounds like an issue in numpy: np.bool_ should define the __index__() method, no?
$ python3
Python 3.7.4 (default, Jul 9 2019, 16:32:37)
>>> import numpy
>>> b=numpy.bool_(True)
>>> b.__int__()
1
>>> b.__index__()
__main__:1: DeprecationWarning: In future, it will be an error for 'np.bool_' scalars to be interpreted as an index
1
The purpose of the DeprecationWarning is to give time to numpy developers to update the bool_() type, before it becomes an error.
I'm not sure of the purpose of this issue, is it just to notice core developers that numpy should be updated? Or do you consider that type.__index__() must continue to fallback on type.__int__() if __index__() is not defined?
In the past, Python was tolerant in term of accepted types. It was hidding some bugs sometimes. We would like to make Python more strict to reduce the risk of bugs. Sadly, it requires to modify your Python code. It's like bytes/str which was strictly separeted in Python 3.0, except that here there is longer and smoother transition period :-) |
|
Date |
User |
Action |
Args |
2019-08-30 11:02:01 | vstinner | set | recipients:
+ vstinner, tim.peters, rhettinger, terry.reedy, mark.dickinson, serhiy.storchaka, seberg, tcaswell, ammar2 |
2019-08-30 11:02:01 | vstinner | set | messageid: <1567162921.51.0.252397719171.issue37980@roundup.psfhosted.org> |
2019-08-30 11:02:01 | vstinner | link | issue37980 messages |
2019-08-30 11:02:01 | vstinner | create | |
|