[Numpy-discussion] detecting shared data

Stefan van der Walt stefan@sun.ac...
Wed Apr 11 17:28:24 CDT 2007


On Wed, Apr 11, 2007 at 06:12:16PM -0400, Matthew Koichi Grimes wrote:
> Is there any way to detect whether one array is a view into another 
> array? I'd like something like:
> 
>  >>> arr = N.arange(5)
>  >>> subarr = arr[1:3]
>  >>> sharesdata(arr, subarr)
> True

Your best bet is probably

N.may_share_memory(arr,subarr)

Cheers
Stéfan


More information about the Numpy-discussion mailing list