On Thu, Jun 13, 2019 at 9:43 PM Marten van Kerkwijk < m.h.vankerkw...@gmail.com> wrote:
> Hi Ralf, > > >>> I guess the one immediate question is whether `np.sum` and the like >>> should be overridden by `__array_function__` at all, given that what should >>> be the future recommended override already works. >>> >> >> I'm not sure I understand the rationale for this. Design consistency >> matters. Right now the rule is simple: all ufuncs have __array_ufunc__, and >> other functions __array_function__. Why keep on tweaking things for little >> benefit? >> > > I'm mostly trying to understand how we would actually change things. > I think we do have ways to deprecate things and reason about how to make the trade-offs to do so. Function overrides are not a whole lot different I think, we can apply the same method (plus there's a special bit in NEP 18 that we reserve the right to change functions into ufuncs and use `__array_ufunc__`). I guess your quite logical argument for consistency is that it requires > `np.sum is np.add.reduce`. But to do that, one would have to get rid of the > `.sum()` method override, and then deprecate using `__array_function__` on > `np.sum`. > > A perhaps clearer example is `np.isposinf`, where the implementation truly > consists of ufunc calls only (indeed, it is in `lib/ufunc_like`). I guess > following your consistency logic, one would not remove the > `__array_function__` override until it actually became a ufunc itself. > Correct. More importantly, I think we should not even consider *discussing* removing` __array_function__` from np.isposinf (or any similar one off situation) before there's a new bigger picture design. This is not about "deprecation is hard", this is about doing things with purpose rather than ad-hoc, as well as recognizing that lots of small changes are a major drain on our limited maintainer resources. About the latter issue I wrote a blog post recently, perhaps that clarifies the previous sentence a bit and gives some more insight in my perspective: https://rgommers.github.io/2019/06/the-cost-of-an-open-source-contribution/ Cheers, Ralf > Anyway, I think this discussion has been useful, if only in making it yet > more clear how difficult it is to deprecate anything! > > 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