[Numpy-discussion] Broadcasting rules (Ticket 76).

Sasha ndarray at mac.com
Mon Apr 24 10:07:06 EDT 2006


I was looking at ticket 76:

http://projects.scipy.org/scipy/numpy/ticket/76

At first, I concluded that the ticket was valid and that

>>> a = zeros([5,2])
>>> a[:] = arange(5)

should raise an error as it did in Numeric.  However, once I started
looking at the code, I've realized that numpy supports more flexible
broadcasting rules than Numeric.

For example:


>>> x = zeros([10])
>>> x[:] = 1,2
>>> x
array([1, 2, 1, 2, 1, 2, 1, 2, 1, 2])

That would be an error in Numeric. Given that the above is valid, the
result in Ticket 76 actually makes sense.

I believe it is time to have some discussion about the future of
broadcasting rules in numpy.  Can anyone provide a summary of the
status quo?




More information about the NumPy-Discussion mailing list