[Numpy-discussion] Determining if two arrays share data
wbaxter at gmail.com
Wed Jul 5 21:39:19 CDT 2006
Often when I'm doing interactive prototyping I find myself wanting to check
whether two arrays are sharing a copy of the same data.
It seems like there ought to be a concise way to do that, but right now
seems like the only way is with a little function like this:
ab = a.base
if ab is None: ab = a
bb = b.base
if bb is None: bb = b
return ab is bb
is there some easier built-in way? Does the above function even cover all
the bases? (so to speak...)
It would be easier if a non-copy array pointed to itself as base rather than
'None'. Then you could just check a.base == b.base.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion