Sebastian Berg sipsolutions.net> writes:
>
> Python has a mechanism both for getting an item and for setting an item.
> The latter will end up doing this (python already does this for us):
> x[:,d,:,d] = x[:,d,:,d] + 1
> so there is an item assignment going on (__setitem__ not __getitem__)
>
> -
The numpy reference manual, array objects/indexing/advance indexing,
says:
Advanced indexing always returns a copy of the data (contrast with
basic slicing that returns a view).
If I run the following code:
import numpy as np
d=range[2]
x=np.arange(36).reshape(3,2,3,2)
y=x[:,d,:,d]
y+=1
p