[Numpy-discussion] Broadcasting with np.logical_and.reduce

Antony Lee antony.lee at berkeley.edu
Fri Sep 12 18:56:26 EDT 2014

I read the "Methods" section of the ufuncs doc page (
http://docs.scipy.org/doc/numpy/reference/ufuncs.html#methods) again and I
think this could be made clearer simply by replacing the first sentence from

"All ufuncs have four methods."


"All ufuncs have five methods that operate on array-like objects." (yes,
there's also "at", which seems to have been added later to the doc...)

This would make it somewhat clearer that

"logical_and.reduce([array([True, False], dtype=bool), array([True],

interprets the single list argument as an array-like (of dtype object)
rather than as an iterable over which to reduce (as python's builtin reduce

In fact there is another point in that paragraph that could be improved;
namely "axis" does not have to be an integer for "reduce".


2014-09-12 10:46 GMT-07:00 Robert Kern <robert.kern at gmail.com>:

> On Fri, Sep 12, 2014 at 5:46 PM, Robert Kern <robert.kern at gmail.com>
> wrote:
> > On Fri, Sep 12, 2014 at 5:44 PM, Antony Lee <antony.lee at berkeley.edu>
> wrote:
> >> I see.  I went back to the documentation of ufunc.reduce and this is not
> >> explicitly mentioned although a posteriori it makes sense; perhaps this
> can
> >> be made clearer there?
> >
> > Please recommend the documentation you would like to see.
> Specifically, the behavior I described is the interaction of several
> different things, but you don't mention which part of it "is not
> explicitly mentioned".
> --
> Robert Kern
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140912/ccfab745/attachment.html>

More information about the NumPy-Discussion mailing list