On Thu, Jun 13, 2019 at 9:35 AM Marten van Kerkwijk <
m.h.vankerkw...@gmail.com> wrote:

> Hi Ralf, others,
>
>
>>>  Anyway, I guess this is still a good example to consider for how we
>>> should go about getting to a new implementation, ideally with just a
>>> single-way to override?
>>>
>>> Indeed, how do we actually envisage deprecating the use of
>>> `__array_function__` for a given part of the numpy API? Are we allowed to
>>> go cold-turkey if the new implementation is covered by `__array_ufunc__`?
>>>
>>
>> I think __array_function__ is still the best way to do this (that's the
>> only actual override, so most robust and performant likely), so I don't see
>> any reason for a deprecation.
>>
>> Yes, I fear I have to agree for the nan-functions, at least for now...
>
> But how about `np.sum` itself? Right now, it is overridden by
> __array_function__ but classes without __array_function__ support can also
> override it through the method lookup and through __array_ufunc__.
>
> Would/should there be a point where we just have `sum = np.add.reduce` and
> drop other overrides? If so, how do we get there?
>
> One option might be start reversing the order in `_wrapreduction` - try
> `__array_ufunc__` if it is defined and only if that fails try the `.sum`
> method.
>

Yes, I think we would need to do this sort of thing. It's a bit of trouble,
but probably doable with some decorator magic. It would indeed be nice for
sum() to eventually just be np.add.reduce, though to be honest I'm not
entirely sure it's worth the trouble of a long deprecation cycle -- people
have been relying on the fall-back calling of methods for a long time.



> All the best,
>
> Marten
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to