<div dir="ltr"><div>I would at least define different classes for the uptalk versions.<br><br></div>But my main complaint is using the parse tree as a spec at all -- it has way too much noise for a clear description. We don't describe a < b < c by first translating it to (Comparison(a, Comparison(b, c, chained=False), chained=True) either: the reference manual uses a postfix * (i.e. repetition) operator to describe chained comparisons -- while for other operators it favors a recursive definition.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 28, 2015 at 7:22 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, Sep 28, 2015, at 17:48, Guido van Rossum wrote:<br>
> > Expr(<br>
> > value=Attribute(<br>
> > value=Attribute(<br>
> > value=Name(id='spam'), attr='eggs', uptalk=True),<br>
> > attr='cheese', uptalk=False))<br>
> ><br>
><br>
> Hm, I think the problem is that this way of representing the tree<br>
> encourages thinking that each attribute (with or without ?) can be<br>
> treated<br>
> on its own.<br>
<br>
</span>How else would you represent it? Maybe some sort of expression that<br>
represents a _list_ of attribute/item/call "operators" that are each<br>
applied, and if one of them results in none and has uptalk=True it can<br>
yield early.<br>
<br>
Something like...<br>
<br>
AtomExpr(atom=Name('spam'), trailers=[Attribute('eggs', uptalk=True),<br>
Attribute('cheese', uptalk=False)])<br>
<br>
For a more complex example:<br>
<br>
a?.b.c?[12](34).f(56)?(78)<br>
<br>
AtomExpr(Name('a'), [<br>
Attribute('b', True),<br>
Attribute('c', False),<br>
Subscript(12, True),<br>
Call([34], False),<br>
Attribute('f', False),<br>
Call([56], False),<br>
Call([78], True)])<br>
<br>
I almost sent this with it called "Thing", but I checked the grammar and<br>
found an element this thing actually maps to.<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<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/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div>