The fact that `isinstance(np.float64(1), float)` raises the problem that the current implementation of np.float64 scalars breaks the Liskov substitution principle: `sequence_or_array[round(x)]` works if `x` is a float, but breaks down if x is a np.float64.
See https://github.com/numpy/numpy/issues/11810, where the issue is discussed in the broader setting of the semantics of `np.round` vs. python3 `round`. I do not have a strong opinion here, except that if np.float64’s are within the python number hierarchy they should be PEP 3141 compliant (which currently they are not.) Stefano > On 25 Feb 2020, at 00:03, numpy-discussion-requ...@python.org wrote: > > Also, something to think about is that currently numpy scalars satisfy > the property `isinstance(np.float64(1), float)`, i.e they are within the > python numerical type hierarchy. 0d arrays do not have this property. My > proposal above would break this. I'm not sure what to think about > whether this is a good property to maintain or not. > > Cheers, > Allan _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion