<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I agree as well. First evaluate the right side, then assign it to
the left side at once.<br>
<br>
<div class="moz-cite-prefix">On 02.09.2015 12:22, Nick Sarbicki
wrote:<br>
</div>
<blockquote
cite="mid:CAGuvt90dWASEjj=_GiZb4jqV4CDF+qqFLH4VS5m_qhUMx6jbJg@mail.gmail.com"
type="cite">
<div dir="ltr">That's interesting. I agree with you, I'd prefer
the second result in both cases.
<div><br>
</div>
<div>But makes sense as it evaluates left to right and seems to
break up the unpacking into separate statements.</div>
<div><br>
</div>
<div>Could be useful if you want to hold the results of a
generator in sequence, can call the same function multiple
times and unpack as above.</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Wed, Sep 2, 2015 at 11:07 AM Antoon Pardon
<<a moz-do-not-send="true"
href="mailto:antoon.pardon@rece.vub.ac.be">antoon.pardon@rece.vub.ac.be</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
>>> a = [1, 2, 3, 4, 5]<br>
>>> b = 1<br>
>>> b, a[b] = a[b], b<br>
>>> a<br>
[1, 2, 1, 4, 5]<br>
>>> a = [1, 2, 3, 4, 5]<br>
>>> b = 1<br>
>>> a[b], b = b, a[b]<br>
>>> a<br>
[1, 1, 3, 4, 5]<br>
<br>
I think I understand how it gets these results<br>
but I'm not really happy with them. I think python<br>
should give the second result in both cases.<br>
<br>
--<br>
Antoon Pardon<br>
<br>
--<br>
<a moz-do-not-send="true"
href="https://mail.python.org/mailman/listinfo/python-list"
rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-list</a><br>
</blockquote>
</div>
<div dir="ltr">-- <br>
</div>
<div dir="ltr"> - Nick</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
</body>
</html>