On Tue, Oct 1, 2013 at 3:13 PM, Charles R Harris <[email protected]> wrote: > > > > On Tue, Oct 1, 2013 at 7:58 AM, Nathaniel Smith <[email protected]> wrote: >> >> I bet the difference is: >> >> In master, nansum ultimately calls arr.sum(...), which will be >> intercepted by Series.sum. >> >> In 1.8.x, nansum ultimately calls np.add.reduce(...), which can't be >> intercepted and will return the wrong thing. >> >> AFAICT the np.add.reduce(a, ...) call could just be replaced with >> a.sum(...), but I might be missing something... surely there must have >> been some reason it was written that way in the first place? > > No good reason, just a bit more efficient. The change for current master was > because of the change in nansum behavior for empty slices. Changing the call > to a.sum is not a problem, although I confess that it seems a bit fragile...
Yeah, ndarray subclassing is always fragile :-/. But hopefully __numpy_ufunc__ will solve the problem in 1.9 and going forward...? (I forget if it's implemented for .reduce yet.) Filed a tracker bug here: https://github.com/numpy/numpy/issues/3849 -n _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
