[Python-ideas] Keyword only argument on function call

Anders Hovmöller boxed at killingar.net
Fri Sep 7 07:06:20 EDT 2018


> I must say I like the idea of being able to write it the way you propose. 
> Sometimes we make a function only to be called once at a specific location, 
> more because of factoring out some functions for clarity. Been doing that 
> myself lately for scripting, and I think it'd increase clarity. However, 
> it's really alike to f(a, b, c), which does something totally different. It 
> -might- become something of a newb trap, as myfunc(*, a, b, c) would be 
> 100% equal to myfunc(*, c, a, b) but that's not true for the f(c, a, b) 
> case.   
>

I've seen beginners make the mistake of calling f(c, a, b) and being 
confused why it doesn't work the way they expected, so I think the newb 
trap might go in the other direction. If by "newb" one means "totally new 
to programming" then I think the keyword style is probably less confusing 
but if you come from a language with only positional arguments (admittedly 
most languages!) then the trap goes in the other direction.

Of course, I don't have the resources or time to make a study about this to 
figure out which is which, but I agree it's an interesting question.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180907/7658cc1b/attachment.html>


More information about the Python-ideas mailing list