
Sept. 29, 2021
11:48 a.m.
Chris Angelico wrote:
On Wed, Sep 29, 2021 at 10:56 PM Dominik Vilsmeier dominik.vilsmeier@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).