[Numpy-discussion] Re: A better syntax for using ufunc.at?

2024-07-24 Thread Lucas Colley
While not about exactly your proposed syntax, the discussion in https://github.com/data-apis/array-api/issues/609 is relevant. Cheers, Lucas > On 24 Jul 2024, at 11:49, Oras P. wrote: > > I am aware that to do unbuffered addition operation, I can use `np.add.at` > like this: > ``` > np.add.at

[Numpy-discussion] A better syntax for using ufunc.at?

2024-07-24 Thread Oras P.
I am aware that to do unbuffered addition operation, I can use `np.add.at` like this: ``` np.add.at(arr, idxs, vals) ``` I think this syntax looks a bit unnatural, and it is not obvious what it does at first glance. An idea I have is to use a custom accessor, like ``` arr.at[idxs] += vals # or a