[SciPy-dev] numpy.broadcast

Robert Kern robert.kern@gmail....
Wed Aug 5 17:40:07 CDT 2009

On Wed, Aug 5, 2009 at 17:23, David Goldsmith<d_l_goldsmith@yahoo.com> wrote:
> --- On Wed, 8/5/09, Robert Kern <robert.kern@gmail.com> wrote:
>> The broadcast *object* doesn't associate. *Broadcasting*
>> associates.
> I understand that; I guess what I don't understand is the relationship between the object and the process.

The broadcast object is an iterator. It has attributes .nd, .shape,
and .size which tell you the number of dimensions, the shape, and the
number of elements of what the broadcasted forms of each the input
arrays would be. For N input arrays, iterating over the broadcast
object would yield you .size N-tuples with the elements from each
input array just as if you were to form the broadcasted arrays for
each of the inputs and then iterate over zip(broadcasted_x.flat,
broadcasted_y.flat, ...).

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco

More information about the Scipy-dev mailing list