[Numpy-discussion] Fancy index assign ignores extra assignees

Andreas Klöckner lists@informa.tiker....
Wed Jun 18 20:44:55 CDT 2008


Hi all,

Is this supposed to be like that, i.e. is the fancy __setitem__ supposed to 
not complain about unused assignees?

>>> v = zeros((10,))
>>> z = [1,2,5]
>>> v[z] = [1,2,4,5]
>>> v
array([ 0.,  1.,  2.,  0.,  0.,  4.,  0.,  0.,  0.,  0.])

Contrast with:

>>> v[1:3] = [1,2,3,4]
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ValueError: shape mismatch: objects cannot be broadcast to a single shape

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080618/6c890b61/attachment.bin 


More information about the Numpy-discussion mailing list