[Python-ideas] Keyword only argument on function call

David Mertz mertz at gnosis.cx
Sat Sep 8 08:45:11 EDT 2018

A finer grained analysis tool would be helpful. I'm -0 on the idea because
I believe it would discourage more expressive names in calling contexts in
order to enable the proposed syntax. But I also see a big difference
between cases where all keywords match calling names and cases where only a
few of them do.

I.e. this is probably a small win:

    # function (a=a, b=b, c=c, d=d)
    function(*, a, b, c, d)

But this feels like it invites confusion and bugs:

    # function (a=my_a, b=b, c=my_c, d=d)
    function(*, a=my_a, b, c=my_c, d)

I recognize that if the syntax were added it wouldn't force anyone to use
the second version... But that means no one who WRITES the code. As a
reader I would certainly have to parse some of the bad uses along with the
good ones.

I know these examples use simplified and artificial names, but I think the
case is even stronger with more realistic names or expressions.

On Sat, Sep 8, 2018, 8:24 AM Anders Hovmöller <boxed at killingar.net> wrote:

> To me, the "30% of all arguments" deserves more careful examination.
> Does the proposal significant improve the reading and writing of this
> code? And are there other, perhaps better, ways of improving this
> code?
> Maybe my tool should be expanded to produce more nuanced data? Like how
> many of those 30% are:
> - arity 1,2,3, etc? (Arity 1 maybe should be discarded as being counted
> unfairly? I don’t think so but some clearly do)
> - matches 1 argument, 2,3,4 etc? Matching just one is of less value than
> matching 5.
> Maybe some other statistics?
> / Anders
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180908/dee71667/attachment.html>

More information about the Python-ideas mailing list