<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Sep 28, 2015 at 1:00 PM, Carl Meyer <span dir="ltr"><<a href="mailto:carl@oddbird.net" target="_blank">carl@oddbird.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 09/28/2015 01:53 PM, Guido van Rossum wrote:<br>
> On Mon, Sep 28, 2015 at 12:43 PM, Carl Meyer <<a href="mailto:carl@oddbird.net">carl@oddbird.net</a><br>
</span><span class="">>     Or put differently, that whereas these two are trivially equivalent (the<br>
>     definition of left-to-right binding within a precedence class):<br>
><br>
>         foo.bar.baz<br>
>         (foo.bar).baz<br>
><br>
>     these two are not equivalent:<br>
><br>
>        foo?.bar.baz<br>
>        (foo?.bar).baz<br>
><br>
><br>
> Right.<br>
><br>
><br>
>     I'm having trouble coming up with a parallel example where the existing<br>
>     short-circuit operators break "extractibility" of a sub-expression like<br>
>     that.<br>
><br>
><br>
> Why is that an interesting property?<br>
<br>
</span>Because breaking up an overly-complex expression into smaller<br>
expressions by means of extracting sub-expressions into temporary<br>
variables is a common programming task (in my experience anyway --<br>
especially when trying to decipher some long-gone programmer's<br>
overly-complex code), and it's usually one that can be handled pretty<br>
mechanically according to precedence rules, without having to consider<br>
that some operators might have action-at-a-distance beyond their precedence.<span class=""><br></span></blockquote><div><br></div><div>Well, if just the foo?.bar.baz part is already too complex you probably need to reconsider your career. :-)<br><br></div><div>Seriously, when breaking things into smaller parts you *have* to understand the shortcut properties. You can't break "foo() or bar()" into<br><br></div><div>  a = foo()<br></div><div>  b = bar()<br></div><div>  return a or b<br><br></div><div>either.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
>     I guess this is because the proposed short-circuiting still "breaks out<br>
>     of the precedence order" in a way that the existing short-circuiting<br>
>     operators don't. Both member access and indexing are within the same<br>
>     left-to-right binding precedence class, but the new operators would have<br>
>     a short-circuit effect that swallows operations beyond where normal<br>
>     left-to-right binding would suggest their effect should reach.<br>
><br>
>     Are there existing examples of behavior like this in Python that I'm<br>
>     missing?<br>
><br>
><br>
> I don't know, but I think you shouldn't worry about this.<br>
<br>
</span>I think it's kind of odd, but if nobody else is worried about it, I<br>
won't worry about it either :-)<span class="HOEnZb"></span><br></blockquote></div><br></div><div class="gmail_extra">Good idea.<br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div>