On Thu, May 3, 2012 at 1:51 AM, Henry Gomersall <[email protected]> wrote:
> Right, so this is expected behaviour then. Is this documented somewhere?
> It strikes me that this is pretty unexpected behaviour.

Imagine the way you would code this in a for-loop.  You want

a = np.arange(10)
a[2:] = a[:-2]

Now you write:

for i in range(2, len(a)):
    a[i] = a[i - 2]

which yields

[0, 1, 0, 1, 0, 1, 0, 1, 0, 1]

One of the great things about NumPy is that it only copies data when
it really has to, and in this case it would need to be very clever to
figure out what you are trying to do.

Stéfan
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to