[Python-ideas] Keyword only argument on function call

Rhodri James rhodri at kynesim.co.uk
Thu Sep 6 10:44:11 EDT 2018


On 06/09/18 15:05, Anders Hovmöller wrote:
> 
> 
> On Thursday, September 6, 2018 at 3:11:46 PM UTC+2, Steven D'Aprano wrote:
>>
>> On Thu, Sep 06, 2018 at 12:15:46PM +0200, Anders Hovmöller wrote:
>>
>>> I have a working implementation for a new syntax which would make
>>> using keyword arguments a lot nicer. Wouldn't it be awesome if instead
>>> of:
>>>
>>>          foo(a=a, b=b, c=c, d=3, e=e)
>>>
>>> we could just write:
>>>
>>>          foo(*, a, b, c, d=3, e)
>>>
>>> and it would mean the exact same thing?
>>
>> No.
> 
> 
> Heh. I did expect the first mail to be uncivil :P

For comparison, my reaction did indeed involve awe.  It was full of it, 
in fact :-p  Sorry, but that syntax looks at best highly misleading -- 
how many parameters are we passing?  I don't like it at all.

>> I'm in favour of consistent naming when it helps the code, when the
>> names are clear and relevant.
> 
> 
> Which is what I'm saying.

Actually you are not.  Adding specific syntax support is a strong signal 
that you expect people to use it and (in this case) use consistent 
naming.  Full stop.  It's a much stronger statement than you seem to think.

>> I disagree that f(*, page) is more readable than an explicit named
>> keyword argument f(page=page).
>>
> 
> People prefer f(page) today. For some reason. That might refute your
> statement or not, depending on why they do it.

Evidence?

-- 
Rhodri James *-* Kynesim Ltd


More information about the Python-ideas mailing list