Closed
Description
Today dask came up a few times and also the possibility of a fallback to __array_function__
for transitioning at least.
This must have come up before, but did we ever discuss an API like:
class myarray:
def __get_namespace__(self, types):
for t in types:
if t is myarray:
continue
if t is np.ndarray: # we know about ndarray!
continue
return NotImplemeneted
return mynamespace
which is not really important if you think about numpy, jax, torch, tensorflow: I don't think you should mix them really! But it seems more becomes interesting if we start talking about dask or quantities which are designed as wrappers?
The answer can be that this is not our problem have to coerce manually. In the NumPy world, we could actually just write get_namespace
as:
@array_function_dispatched(lambda *args: args)
def get_namespace(*args):
return numpy
(and assume others will return their namespace, since in practice everyone has it de-facto)