2008/6/3 Robert Kern <[EMAIL PROTECTED]>: > Python does not copy data when you assign something to a new variable. > Python simply points the new name to the same object. If you modify > the object using the new name, all of the other names pointing to that > object will see the changes. If you want a copy, you will need to > explicitly make one. For numpy arrays, the best way to do this is to > use array(). > > m_i = array(m_o)
Is array() really the best way to copy an array? I would have thought m_i = m_o.copy() would be better - requiring less of array's clever guessing, and preserving subtypes. On the downside it doesn't work if you're given a list, but perhaps np.copy() would be better (though it loses subtype information)? Certainly it's clearer. Anne _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion