<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 11 May 2018 at 12:45, Tim Peters <span dir="ltr"><<a href="mailto:tim.peters@gmail.com" target="_blank">tim.peters@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">[Nick Coghlan]<br>
<span>> I've been thinking about this problem, and I think for the If/elif/while<br>
> cases it's actually possible to allow the "binding is the same as the<br>
> condition" case to be simplified to:<br>
><br>
>     if command =  pattern.match(the_string):<br>
>         ...<br>
>     elif command =  other_pattern.match(the_string<wbr>):<br>
>         ...<br>
><br>
>     while data = read_data():<br>
<br>
</span>Unless there's some weird font problem on my machine, that looks like<br>
a single "equals sign".  In which case we'd be reproducing C's<br>
miserable confusion about whether:<br>
<br>
    if (i = 1)<br>
<br>
was a too-hastily-typed spelling of the intended:<br>
<br>
    if (i == 1)<br>
<br>
or whether they were thinking "equals" and typed "=" by mistake.<br>
<br>
If so, that would get an instant -1 from any number of core devs, who<br>
have vivid painful memories of being burned by that in C.  That's not<br>
just speculation - it came up a number of times in the PEP 572<br>
threads.<br></blockquote><div><br clear="all"></div></div>I was one of those core devs, and would personally prefer to require that folks spell the inline binding completely unambiguously as "if i given i = 1:".<br><br></div><div class="gmail_extra">However, if the repetition of "i" is considered a deal breaker relative to ":=" (even though the status quo already requires repetition of the target name in the condition), then I'd prefer to add this shorthand (which folks can then opt to prohibit in favour of the more explicit form in their style guides) over adding the cognitive complexity of deciding when to use "i = 1" and when to use "i := 1".<br></div><br><div class="gmail_extra">Cheers,<br></div><div class="gmail_extra">Nick.<br></div><div class="gmail_extra"><br>-- <br><div class="m_-6541872046050451373gmail_signature" data-smartmail="gmail_signature">Nick Coghlan   |   <a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>   |   Brisbane, Australia</div>
</div></div>