Sounds like I'm not the only one surprised then: http://projects.scipy.org/numpy/ticket/2220
Matthew Brett wrote: > Hi, > > On Mon, Oct 1, 2012 at 9:04 AM, Pierre Haessig <[email protected]> > wrote: >> Hi, >> >> Le 28/09/2012 21:02, Neal Becker a écrit : >>> In [19]: u = np.arange (10) >>> >>> In [20]: v = np.arange (10) >>> >>> In [21]: u[v] = u >>> >>> In [22]: u[v] = np.arange(11) >>> >>> silence... >> I've same behavior with my numpy 1.6.2. >> >> It indeed looks strange that the end of the data vector is dropped in >> silence. > > Same on numpy 1.4.1. I also would have predicted an error in that > situation. For example in matlab: > >>> a = 1:10 > > a = > > 1 2 3 4 5 6 7 8 9 10 > >>> b = 1:10 > > b = > > 1 2 3 4 5 6 7 8 9 10 > >>> a(b) = 11:20 > > a = > > 11 12 13 14 15 16 17 18 19 20 > >>> a(b) = 11:21 > ??? In an assignment A(I) = B, the number of elements in B and > I must be the same. > > Is there any reason not to do that? > > Best, > > Matthew _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
