[Numpy-discussion] View on sliced array without copy
Nicolas Rougier
Nicolas.Rougier at inria.fr
Tue Feb 12 12:53:17 EST 2013
Hi,
I'm trying to get a view on a sliced array without copy but I'm not able to do it as illustrated below:
dtype = np.dtype( [('color', 'f4', 4)] )
Z = np.zeros(100, dtype=dtype)
print Z.view('f4').base is Z # True
print Z[:50].base is Z # True
print (Z.view('f4'))[:50].base is Z # False
print Z[:50].view('f4').base is Z # False
Did I do something wrong or is it expected behavior ?
Nicolas
More information about the NumPy-Discussion
mailing list