[Python-ideas] Keyword only argument on function call

Jacco van Dorp j.van.dorp at deonet.nl
Fri Sep 7 02:59:44 EDT 2018

Op vr 7 sep. 2018 om 04:49 schreef Anders Hovmöller <boxed at killingar.net>:

> Maybe something like this would be better:
>>     f(=a, =b, =c)
> Haha. Look at my PEP, it's under "rejected alternative syntax", because of
> the super angry replies I got on this very mailing list when I suggested
> this syntax a few years ago :P
> I think that syntax is pretty nice personally, but me and everyone at work
> I've discussed this with think that f(*, a, b, c) syntax is even nicer
> since it mirrors "def f(*, a, b, c)" so nicely. Most replies to my new
> syntax has been along the lines of "seems obvious" and "ooooh" :P

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)

I dislike the f(=arg) syntax.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180907/04d63c99/attachment.html>

More information about the Python-ideas mailing list