<div dir="ltr">Obviously the AST needs to be changed. How? I dunno. Sounds like you have some ideas. :-)<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 31, 2016 at 2:44 PM, Random832 <span dir="ltr"><<a href="mailto:random832@fastmail.com" target="_blank">random832@fastmail.com</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 Mon, Oct 31, 2016, at 13:16, Guido van Rossum wrote:<br>
> For "everything to the right" it would seem we have some freedom: e.g.<br>
> if we have "foo.bar?.baz(bletch)" is the call included? The answer is<br>
> yes -- the concept we're after here is named "trailer" in the Grammar<br>
> file in the source code (<br>
> <a href="https://github.com/python/cpython/blob/master/Grammar/Grammar#L119" rel="noreferrer" target="_blank">https://github.com/python/<wbr>cpython/blob/master/Grammar/<wbr>Grammar#L119</a>),<br>
> and "primary" in the reference manual (<br>
> <a href="https://docs.python.org/3/reference/expressions.html#primaries" rel="noreferrer" target="_blank">https://docs.python.org/3/<wbr>reference/expressions.html#<wbr>primaries</a>). This<br>
> means all attribute references ("x.y"), index/slice operations<br>
> ("x[...]"), and calls ("x(...)").<br>
<br>
</span>One thing that I think I touched on in an earlier iteration of this<br>
discussion but hasn't been revisited is: what's the AST going to look<br>
like?<br>
<br>
Right now, foo.bar.baz(bletch) is Call(Attribute(Attribute(Name(<wbr>'foo'),<br>
'bar'), 'baz'), [Name('bletch')])), which is identical to<br>
(foo.bar).baz(bletch) or (foo.bar.baz)(bletch). These are treated,<br>
essentially, as postfix operators, where you can parenthesize any left<br>
part of the expression and leave its meaning [and its AST] unchanged.<br>
<br>
Is the AST going to be unchanged, leading to the conclusion that the<br>
short-circuiting in (foo?.bar).baz will "reach outside of" the<br>
parentheses, and relying on the fact that wanting to do that with None<br>
is a silly thing to do in almost all cases? Or is there going to be a<br>
new kind of AST that is sequential rather than recursive in how it<br>
represents trailer/primary expressions?<br>
<div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div>