
On Fri, Apr 17, 2020 at 5:08 AM Steven D'Aprano <steve@pearwood.info> wrote:
On Thu, Apr 16, 2020 at 07:50:30PM +0200, Alex Hall wrote:
And what would you do if you wanted to call:
self.do_something(positional, keyword=keyword, keyword1=somethingelse, keyword2=keyword2)
?
Eric
I think this is still pretty clear:
self.do_something(positional, *, keyword, keyword1=somethingelse, keyword2)
It's not clear to me. It's currently (3.8) illegal syntax, and I have no idea what the `*` would mean in the function call.
Of course it's currently illegal syntax, that's the point. I don't think you really need to know what it means to read the code for most purposes. You look at the function call and you can see a bunch of names being passed to self.do_something. If the function call has 'keyword=keyword' in it instead of just 'keyword', that's not adding much information. The technical details of how an argument is being passed are usually not important to readers.
I know what it means in function definitions, but somehow we seem to have (accidentally?) flipped from talking about Rhodi's dislike of the `*` in function *definitions* to an (imaginary? proposed?) use of `*` in function *calls*.
Have I missed something?
Something weird seems to have happened in this thread. Rodrigo first proposed the magic asterisk syntax here: https://mail.python.org/archives/list/python-ideas@python.org/message/N2ZY5N... There were some replies discussing that proposal, including objections, to which I responded: https://mail.python.org/archives/list/python-ideas@python.org/message/KTJBGO... For some reason Ricky called it my suggestion when it was Rodrigo's: https://mail.python.org/archives/list/python-ideas@python.org/message/QYC6F4... And now it looks like you missed it too.