title: Is there a way to check if NumPy arrays share the same data?
body: <p>My impression is that in NumPy, two arrays can share the same memory. Take the following example:</p>
  
  <pre><code>import numpy as np
  a=np.arange(27)
  b=a.reshape((3,3,3))
  a[0]=5000
  print (b[0,0,0]) #5000
  
  #Some tests:
  a.data is b.data #False
  a.data == b.data #True
  
  c=np.arange(27)
  c[0]=5000
  a.data == c.data #True ( Same data, not same memory storage ), False positive
  </code></pre>
  
  <p>So clearly <code>b</code> didn't make a copy of <code>a</code>; it just created some new meta-data and attached it to the same memory buffer that <code>a</code> is using. Is there a way to check if two arrays reference the same memory buffer?</p>
  
  <p>My first impression was to use <code>a.data is b.data</code>, but that returns false. I can do <code>a.data == b.data</code> which returns True, but I don't think that checks to make sure <code>a</code> and <code>b</code> share the same memory buffer, only that the block of memory referenced by <code>a</code> and the one referenced by <code>b</code> have the same bytes.</p>