[Numpy-discussion] List Array References?

Alexander Michael lxander.m@gmail....
Fri Feb 15 07:28:08 CST 2008


On Fri, Feb 15, 2008 at 7:12 AM, Stefan van der Walt <stefan@sun.ac.za> wrote:
>  As far as I know, the reference count to the array is increased when
>  you create a view, but the views themselves are not tracked anywhere.
>  You can therefore say whether there are references around, but you
>  cannot identify the Python objects.

I would like to occasionally dynamically grow an array (i.e. add
length to existing dimensions) as I do not know th ultimately required
length beforehand, but I have a good guess so I won't be need to
reallocate that often if at all. The only way I know how to do this is
numpy is to create a new larger array with the new dimensions and copy
the existing data from the smaller array into it. Perhaps there is a
better way that doesn't invalidate views on the array? I want to make
sure that there are no outstanding references to the old array (i.e.
views on it, etc.) so that I can raise a helpful exception while
developing.

Robin and Davide-
Thanks for the pointer to the numpy.who method, while that only
searches in a specified dictionary, it was the method that I thought I
had encountered before.


More information about the Numpy-discussion mailing list