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 <nicolas.roug...@inria.fr> 
> 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 the release:
> 
> The ``.base`` attribute on ndarrays, which is used on views to ensure that the
> underlying array owning the memory is not deallocated prematurely, now
> collapses out references when you have a view-of-a-view. For example::
> 
>     a = np.arange(10)
>     b = a[1:]
>     c = b[1:]
> 
> In numpy 1.6, ``c.base`` is ``b``, and ``c.base.base`` is ``a``. In numpy 1.7,
> ``c.base`` is ``a``.
>  
> Jaime
> 
> -- 
> (\__/)
> ( O.o)
> ( > <) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus planes de 
> dominación mundial.
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to