Do any other languages already have this feature?

Can you show some actual real-life code that would benefit from this, as 
opposed to pretend code like:

    foo(bar=, qux=)

I think that if I had seen this syntax as a beginner, I would have had 
absolutely no idea how to interpret it. I probably would have decided 
that Python was an unreadably cryptic language and gone on to learn 
something else.

Of course, with 20+ years of experience reading and writing code, I 
know better now. I would interpret it as setting bar and qux to some 
kind of Undefined value.

I am very sympathetic to the rationale:

"it is quite common to find code that forwards keyword parameters having 
to re-state keyword arguments names"

and I've discussed similar/related issues myself, e.g. here:

https://mail.python.org/pipermail/python-list/2018-February/881615.html

But I am not convinced that adding magic syntax to implicitly guess the 
value wanted as argument if it happens to match the parameter name is a 
good design feature.

Is being explicit about the value that you are passing to a parameter 
really such a burden that we need special syntax to avoid stating what 
value we are using as the argument?

I don't think it is. And I would far prefer to read explicit code like 
this:

    # Slightly modified from actual code.
    self.do_something(
        meta=meta,
        dunder=dunder,
        private=private,
        invert=invert,
        ignorecase=ignorecase,
        )

over the implicit version:

    # Looks like code I haven't finished writing :-(
    self.do_something(meta=, dunder=, private=, invert=, ignorecase=)


Out of the millions of possible values we might pass, I don't think that 
the func(spam=spam) case is so special that we want to give it special 
syntax.

-- 
Steven
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/VCCQ6BOVEQZ4ZWLKVDTVUCMAWD2VQL7B/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to