Re: [Numpy-discussion] View on sliced array without copy

2013-02-12 Thread Nicolas Rougier
I did not know that. Thanks for the clear explanation. Nicolas On Feb 12, 2013, at 19:25 , Jaime Fernández del Río wrote: > On Tue, Feb 12, 2013 at 9:53 AM, Nicolas Rougier > wrote: > Did I do something wrong or is it expected behavior ? > > Try: > > print (Z.view('f4'))[:50].base.base is

Re: [Numpy-discussion] View on sliced array without copy

2013-02-12 Thread Jaime Fernández del Río
On Tue, Feb 12, 2013 at 9:53 AM, Nicolas Rougier wrote: > Did I do something wrong or is it expected behavior ? > Try: print (Z.view('f4'))[:50].base.base is Z # True print Z[:50].view('f4').base.base is Z # True This weird behaviour is fixed in the just-released numpy 1.7. From the notes of

[Numpy-discussion] View on sliced array without copy

2013-02-12 Thread Nicolas Rougier
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]