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
``ndarray.__repr__`` and ``ndarray.__str__`` should not rely upon
``__array_function__`` internally, so they are still well defined on subclasses
even if ``array_repr`` and ``array_str`` are not implemented.
Fixesnumpygh-12162
What's special about __repr__ that means it's allowed to work when __array_function__ doesn't support it, yet something like np.reshape is not?
Should @array_function_dispatch(dispatcher, allow_not_implemented=True) be a thing, which causes the base function to run even if all the arguments return NotImplemented? I think this is like the NotImplementedButCoercible proposal, except it's a property of functions not the array-likes.
What's special about __repr__ that means it's allowed to work when __array_function__ doesn't support it, yet something like np.reshape is not?
I would expect that any ndarray method should work on subclasses as long as the method isn't overridden, regardless of whether or not __array_function__ is defined.
So np.reshape() isn't special enough, but .reshape() would be.
The problem appears to be that
ndarray.__repr__
is mapped internally to callnp.array_repr()
:This is a somewhat poor user experience. We should map
ndarray.__repr__
tonp.array_repr.__wrapped__
instead.The text was updated successfully, but these errors were encountered: