[Python-ideas] Keyword only argument on function call

Anders Hovmöller boxed at killingar.net
Thu Sep 6 22:38:02 EDT 2018

> 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)

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'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 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. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180906/e0ffb993/attachment-0001.html>

More information about the Python-ideas mailing list