<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-11-27 15:39 GMT+03:00 Paul Moore <span dir="ltr"><<a href="mailto:p.f.moore@gmail.com" target="_blank">p.f.moore@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On 27 November 2017 at 12:31, Kirill Balunov <<a href="mailto:kirillbalunov@gmail.com">kirillbalunov@gmail.com</a>> wrote:<br>
> As I can see at the moment, these cases should behave differently:<br>
><br>
>>>> x, y = [1,2,3,4]             # must raise ValueError<br>
>>>> x, y = iter([1,2,3,4])      # should work<br>
><br>
> But at the same time, it violates current situation. So maybe, as you have<br>
> said we need special syntax. I will think about it.<br>
<br>
</span>I would find this confusing. Consider where you don't have literals:<br>
<br>
def f(vals):<br>
    x, y = vals<br>
<br>
data = [1,2,3,4]<br>
<br>
f(data)<br>
data = iter(data)<br>
f(data)<br>
<br>
Having the two calls behave differently would be a recipe for errors<br>
as someone refactors the calling code.<span class="gmail-HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div><span id="gmail-result_box" class="gmail-short_text" lang="en"><span class="gmail-">I can not completely disagree with you,</span></span> but we all adults here. My first proposal was about generators only, <span id="gmail-result_box" class="gmail-short_text" lang="en"><span class="gmail-">but they are very similar to iterators in their behavior. </span></span><span id="gmail-result_box" class="gmail-short_text" lang="en"><span class="gmail-">Whatever it was with this syntax, there will be no difference:</span></span></div><div><span id="gmail-result_box" class="gmail-short_text" lang="en"><span class="gmail-"><br></span></span></div><div><span id="gmail-result_box" class="gmail-short_text" lang="en"><span class="gmail-">def f(vals):</span></span></div><div><span id="gmail-result_box" class="gmail-short_text" lang="en"><span class="gmail-">    x, y = vals</span></span></div><div><span id="gmail-result_box" class="gmail-short_text" lang="en"><span class="gmail-"><br></span></span></div>data = [1,2,3,4]</div><div class="gmail_quote"><br></div><div class="gmail_quote">f(data)</div><div class="gmail_quote">data = (i for i in data)</div><div class="gmail_quote">f(data)</div><div class="gmail_quote"><br></div><div class="gmail_quote">With kind regards, -gdg<br></div><div class="gmail_quote"><div><span id="gmail-result_box" class="gmail-short_text" lang="en"><span class="gmail-"><br></span></span></div><div><span id="gmail-result_box" class="gmail-short_text" lang="en"><span class="gmail-"><br></span></span></div><div><span id="gmail-result_box" class="gmail-short_text" lang="en"><span class="gmail-"><br></span></span> </div></div></div></div>