On Apr 20, 2020, at 01:06, M.-A. Lemburg <m...@egenix.com> wrote:
> 
> The current version already strikes me as way too complex.
> It's by far the most complex piece of grammar we have in Python:
> 
> funcdef: 'def' NAME parameters ['->' test] ':' [TYPE_COMMENT]
> func_body_suite

But nobody’s proposing changing the function definition syntax here, only the 
function call syntax. Which is a lot less hairy. It is still somewhat hairy, 
but nowhere near as bad, so this argument doesn’t really apply.

Also, you’re lumping all the different proposals here, but they don’t all have 
the same effect, which makes the argument even weaker.

Adding a ** mode switch does make calls significantly more complicated, because 
it effectively clones half of the call grammar to switch to a similar but new 
grammar.

But allowing keyword= is a simple and local change to one small subpart of the 
call grammar that I don’t think adds too much burden.

And ::value in dict displays doesn’t touch the call syntax at all; it makes 
only a trivial and local change to a subpart of the much simpler dict display 
grammar.

And **{a,b,c} is by far the most complicated, but the complicated part isn’t in 
calls (which would just gain one simple alternation); it’s in cloning half of 
the expression grammar to create a new nonset_expression node; the change to 
call syntax to use that new node is simple. (I’m assuming this proposal would 
make **{set display} in a call a syntax error when it’s not a magic 
set-of-identifiers unpacking, because otherwise I don’t know how you could 
disambiguate at all.)

So, even if you hadn’t mixed up definitions and calls, I don’t think this 
argument really holds much water.

I think your point that “hard to parse means hard to reason about” is a good 
one, however. That’s part of my rationale for the ::value syntax in dict 
displays: it’s a simple change to a simple piece of syntax that’s well isolated 
and consistent everywhere it appears. But I don’t think people would actually 
have a problem learning, internalizing, and reading keyword= syntax. And I 
think it may be an argument against the **{a,b,c} syntax, but only in a more 
subtle way than you’re advancing—people wouldn’t even internalize the right 
grammar; they’d just think of it as a special use of set displays (in fact 
Steven, who proposed it, encourages that reading), which is an extra special 
case to learn. Which can still be acceptable (lots of people get away with 
thinking of target lists as a special use of tuple displays…); it’s just a 
really high bar to clear.
_______________________________________________
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/JNENJWUEORPQ6UMMTWQPMKAZUBDE37B3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to