[Python-ideas] Keyword only argument on function call

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Sep 6 18:39:07 EDT 2018


Rhodri James wrote:
> that syntax looks at best highly misleading -- 
> how many parameters are we passing?  I don't like it at all.

Maybe something like this would be better:

    f(=a, =b, =c)

Much more suggestive that you're passing a keyword argument.

As for whether consistent naming is a good idea, seems to
me it's the obvious thing to do when e.g. you're overriding
a method, to keep the signature the same for people who want
to pass arguments by keyword. You'd need to have a pretty
strong reason *not* to keep the parameter names the same.

Given that, it's natural to want a way to avoid repeating
yourself so much when passing them on.

So I think the underlying idea has merit, but the particular
syntax proposed is not the best.

-- 
Greg


More information about the Python-ideas mailing list