[Python-ideas] Keyword only argument on function call

Rhodri James rhodri at kynesim.co.uk
Fri Sep 7 09:13:17 EDT 2018

On 07/09/18 03:38, Anders Hovmöller wrote:
>> 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.
> (nitpick: we're passing arguments, not parameters)

potayto, potahto

> I don't see how this could be confusing. Do you think it's confusing how
> many parameters a function has in python now because of the keyword only
> marker? This suggestion follows the same rules you should already be
> familiar with when counting parameters, why would you now have trouble
> counting when the line doesn't begin with "def " and end with ":"?

I counted commas.  I came up with the wrong number.  Simple.

For what it's worth, I don't like the keyword-only marker or the 
proposed positional-only marker for exactly the same reason.

>>>> 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 expect this to be common enough to warrant nicer language constructs
> (like OCaml has). I expect people today to use positional arguments to get
> concise code, and I think python pushes people in this direction. This is a
> bad direction imo.

I disagree.  Keyword arguments are a fine and good thing, but they are 
best used for optional arguments IMHO.  Verbosity for the sake of 
verbosity is not a good thing.

>>>> 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?
> Run my analysis tool. Check the numbers. It's certainly true at work, and
> it's true for Django for example.

OK, then your assertion didn't mean what I thought it means, and I'm 
very confused about what it does mean.  Could you try that again?

Rhodri James *-* Kynesim Ltd

More information about the Python-ideas mailing list