[Numpy-discussion] Adding to the non-dispatched implementation of NumPy methods
Marten van Kerkwijk
m.h.vankerkwijk at gmail.com
Sun Apr 28 12:57:15 EDT 2019
Agreed that the coercion right now is *not* generic, with some doing
`asarray`, others `asanyarray` and yet others nothing. There are multiple
possible solutions, with one indeed being that for each function one moves
the coercion bits out to an associated intermediate function. In principle,
as I mentioned above, one could then think of letting that intermediate
function take on a coercion function (i.e., `asarray`, `asanyarray` or even
any one's favourite coercion function), which might make it possible to
generate them semi-automatically.
Anyway, as said, mostly I want to be sure we leave ourselves the freedom to
experiment with that as well, and not get bound by `__wrapped__` or
`__numpy_implementation__` becoming effectively a second layer of API. But
for actual experiments, it may well be better to try `__array_ufunc__`
first, as for ufuncs coercion is uniform.
All the best,
p.s. Good point also about checking of non-array inputs.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion