[Numpy-discussion] Determine if two arrays share references

Keith Goodman kwgoodman@gmail....
Wed Feb 10 21:41:50 CST 2010

Here are two arrays that share references:

>> x = np.array([1,2,3])
>> y = x[1:]

and here are two that don't:

>> x = np.array([1,2,3])
>> y = x[1:].copy()

If I didn't know how the arrays were constructed, how would I
determine if any elements in the two arrays share reference?

(I'm not sure of my terminology. Please correct me if I'm wrong.)

More information about the NumPy-Discussion mailing list