On Sat, Sep 4, 2021 at 6:06 AM Kevin Mills <kevin.mills...@gmail.com> wrote:
> If we don't cheat by comparing expressions to expression lists, the two are 
> fairly analogous. `f(t)` means pass the tuple to the function, and `d[t]` 
> means use the tuple as a key. `f(*t)` means break up the tuple and pass each 
> element as an argument to the function, and `d[*t]` means break up the tuple 
> and pass each element to getitem in turn.
>

Cheat? But that's the exact context in which starred expressions have
meaning. When you call f(1,2,3), you're not calling f(1)(2)(3). You're
passing all of those arguments to a single function call. That's why
d[*t] would have to mean d[1,2,3] not d[1][2][3].

ChrisA
_______________________________________________
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/K2SHHSBFOW5FPQDHHUB5W6XLSKRAEZZR/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to