[SciPy-user] Assignment of oversize values.
Sun Jul 19 23:30:18 CDT 2009
On 19-Jul-09, at 8:08 AM, Yosef Meller wrote:
> I expected this to raise an exception about shape error or
> something, but it
> did not.
> The NumPy documentation  doesn't mention this case, so I just
> wanted to ask
> if that's the intended behaveiour.
I'm pretty sure it is intended behaviour; this is perfectly consistent
with the way sequence modification works even with normal Python lists.
In : X = range(10)
In : Y = range(10, 20)
In : X[:5] = Y
In : X
Out: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 5, 6, 7, 8, 9]
Similarly if you try to zip(a, b) on two things together of different
lengths, you get back a sequence of tuples that is length min(len(a),
len(b)) - the extras are discarded.
More information about the SciPy-User