[Python-ideas] Keyword only argument on function call

Bruce Leban bruce at leban.us
Sun Sep 9 01:30:33 EDT 2018


The proposal is to eliminate the redundancy of writing name=name
repeatedly. But IMHO it doesn't do that consistently. That is it allows
both forms mixed together, e.g.,

f(*, a, b, c=x, d, e)

I believe this is confusing in part because the * need not be near the
arguments it affects. Consider

open(*, name='temp.txt', mode='r', buffering=-1, encoding='utf-8', errors)

By the time you get to the last arg, you'll have forgotten the * at the
beginning. If Python were to adopt a syntax to address this, I think it
should be something like

f(=a, =b, c=x, =d, =e)
open(name='temp.txt', mode='r', buffering=-1, encoding='utf-8', =errors)

Where an = in an argument list without a name in front of it uses the
symbol on the right hand side as the name.

--- Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180908/313abded/attachment-0001.html>


More information about the Python-ideas mailing list