[Numpy-discussion] Fixing inconsistent behaviour of reduceat()

Marten van Kerkwijk m.h.vankerkwijk at gmail.com
Thu Apr 13 11:03:56 EDT 2017

Discussion on-going at the above issue, but perhaps worth mentioning
more broadly the alternative of adding a slice argument (or start,
stop, step arguments) to ufunc.reduce, which would mean we can just
deprecate reduceat altogether, as most use of it would just be

add.reduce(array, slice=slice(indices[:-1], indices[1:])

(where now we are free to make the behaviour match what is expected
for an empty slice)

Here, one would broadcast the slice if it were 0-d, and could pass in
tuples of slices if a tuple of axes was used.

-- Marten

More information about the NumPy-Discussion mailing list