Chris Angelico wrote:
> On Wed, Sep 29, 2021 at 10:56 PM Dominik Vilsmeier
> dominik.vilsme...@gmx.de wrote:
> > members.sort(key=(?[1], ?[0]))
> > How do you know whether this is one function that returns a tuple, or
> a tuple of two functions?
> ChrisA

You are right, I didn't think of this ambiguity w.r.t. to the start of the 
expression. While `lambda` clearly marks where the lambda body starts, `?` 
doesn't do this. Actually the above example could also be translated to `lambda 
x: members.sort(key=(x[1], x[0]))` (which doesn't make sense, of course, but 
it's valid syntax).
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/6NGYVZZP7K3ZEHETHKU4AVDHA24QMICY/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to