<div class="gmail_quote">On Fri, Mar 11, 2011 at 1:07 AM, Ralf Gommers <span dir="ltr"><<a href="mailto:ralf.gommers@googlemail.com">ralf.gommers@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
On Tue, Mar 8, 2011 at 1:35 AM, Pauli Virtanen <<a href="mailto:pav@iki.fi">pav@iki.fi</a>> wrote:<br>
><br>
> Structured array copying copies by field name.<br>
><br>
> Commit 22d96096bf7d5fb199ca80f2fcd04e8d27815476<br>
><br>
> Before:<br>
><br>
>>>> x = np.array([(0, 1)], dtype=[('a', int), ('b', int)])<br>
>>>> y = np.array([(2, 3)], dtype=[('a', int), ('b', int)])<br>
>>>> y = np.array([(2, 3)], dtype=[('b', int), ('a', int)])<br>
>>>> x[:] = y<br>
>>>> x<br>
> array([(2, 3)],<br>
>      dtype=[('a', '<i4'), ('b', '<i4')])<br>
><br>
> After:<br>
><br>
>>>> x = np.array([(0, 1)], dtype=[('a', int), ('b', int)])<br>
>>>> y = np.array([(2, 3)], dtype=[('b', int), ('a', int)])<br>
>>>> x[:] = y<br>
>>>> x<br>
> array([(3, 2)],<br>
>      dtype=[('a', '<i4'), ('b', '<i4')])<br>
><br>
> This seems like a pretty hazardous change. Granted, it's in<br>
> a bit of a grey area, but people may rely on this.<br>
<br>
This is still backwards incompatible in current master. Should it be<br>
changed back for 1.6?<br></blockquote><div><br></div><div>I strongly dislike the behavior in 1.5 and earlier, for reasons such as the example given here:</div><div><br></div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>
<a href="http://mail.scipy.org/pipermail/numpy-discussion/2011-March/055214.html">http://mail.scipy.org/pipermail/numpy-discussion/2011-March/055214.html</a></div><div><br></div><div><a href="http://mail.scipy.org/pipermail/numpy-discussion/2011-March/055214.html"></a>No problems so far have been traced back to this change, indicating that this type of assignment was previously utilized very little, so I'm strongly in favor of keeping it in. Based on my knowledge of the code, I'm pretty sure it's a significant performance improvement as well.</div>
<div><br></div><div>-Mark</div></div>