-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
While the idea of using a function to create a nested namespace is neat, it makes creating arrays harder:
import marray
import numpy as np
xp = marray.masked_array(np)
a = xp.asarray(np.arange(10))
a.mask[...] = np.arange(10) % 2 == 0
What I'd like to have (but don't quite know how easy it is to support, nor if it actually is a good idea) is something like this:
import marray
import numpy as np
a = marray.MaskedArray(data=np.arange(10), mask=np.arange(10) % 2 == 0)
xp = a.__array_namespace__() # nested namespace
Alternatively, this could also work (since the Array API doesn't forbid adding non-standard things to the namespace):
xp = marray.masked_array(np)
a = xp.MaskedArray(data=np.arange(10), mask=np.arange(10) % 2 == 0)
However, I would imagine that this makes creating / composing arrays a bit harder. And since we don't subclass arrays classes anymore, maybe we don't even need the dynamic namespace (and thus the meta-programming)?
Metadata
Metadata
Assignees
Labels
No labels