[Numpy-discussion] Allowing broadcasting of code dimensions in generalized ufuncs

Marten van Kerkwijk m.h.vankerkwijk at gmail.com
Thu May 31 09:58:44 EDT 2018


<snip>
> Incidentally, once we make reduce/accumuate/... into "associated gufuncs", I
> propose completely removing the "method" argument of __array_ufunc__, since
> it is no longer needed and adds a lot
> of complexity which implementors of an __array_ufunc__ are forced to
> account for.

For Quantity at least I found it somewhat helpful to have the method
separate from the ufunc, as how one deals with it still has
similarities. Though it would probably have been similarly easy if
`__array_ufunc__` had been passed `np.add.reduce` directly. Aside: am
not sure we can so easily remove `method` any more, but I guess we can
at least start getting to a state where it always is `__call__`.

Anyway, this does argue we should be rather careful with signatures..
In particular, for `__array_function__` we really need to think
carefully about `types` - an `__array_function__` specific dict at the
end may be more useful.

All the best,

Marten


More information about the NumPy-Discussion mailing list