Hi Ralf,

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,

Marten

p.s. Good point also about checking of non-array inputs.
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to