Re: [Numpy-discussion] views and object lifetime

2009-02-18 Thread Travis E. Oliphant
Neal Becker wrote: > How is it ensured, at the C api level, that when I have an array A, and a view > of it B, that the data is not destroyed until both A and B are? > One array, A, owns the data and will deallocate it only when its reference-count goes to 0.The view, B, has a reference to

Re: [Numpy-discussion] views and object lifetime

2009-02-18 Thread Scott Sinclair
> 2009/2/18 Neal Becker : > Matthieu Brucher gmail.com> writes: > >> >> B has a reference to A. > > Could you be more specific? Where is this reference stored? What C api > functions are used? I'm probably not qualified to be much more specific, these links should provide the necessary detail:

Re: [Numpy-discussion] views and object lifetime

2009-02-18 Thread Gael Varoquaux
On Wed, Feb 18, 2009 at 01:02:54PM +, Neal Becker wrote: > > B has a reference to A. > Could you be more specific? Where is this reference stored? In [1]: import numpy as np In [2]: a = np.empty(10) In [3]: b = a[::2] In [4]: b.base is a Out[4]: True Gaƫl __

Re: [Numpy-discussion] views and object lifetime

2009-02-18 Thread Matthieu Brucher
2009/2/18 Neal Becker : > Matthieu Brucher gmail.com> writes: > >> >> B has a reference to A. > > Could you be more specific? Where is this reference stored? What C api > functions are used? I don't remember, and I don't have the Numpy book here. But if B is a view on A, a flag indicates that B

Re: [Numpy-discussion] views and object lifetime

2009-02-18 Thread Neal Becker
Matthieu Brucher gmail.com> writes: > > B has a reference to A. Could you be more specific? Where is this reference stored? What C api functions are used? > Matthieu > > 2009/2/18 Neal Becker gmail.com>: > > How is it ensured, at the C api level, that when I have an array A, and a view > >

Re: [Numpy-discussion] views and object lifetime

2009-02-18 Thread Matthieu Brucher
B has a reference to A. Matthieu 2009/2/18 Neal Becker : > How is it ensured, at the C api level, that when I have an array A, and a view > of it B, that the data is not destroyed until both A and B are? > > ___ > Numpy-discussion mailing list > Numpy-d

[Numpy-discussion] views and object lifetime

2009-02-18 Thread Neal Becker
How is it ensured, at the C api level, that when I have an array A, and a view of it B, that the data is not destroyed until both A and B are? ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-d