Dear Steve,

Thank you for your thoughts.

To be precise, the sequence of letters "*(1,2)" is not actually a
"starred expression" in the sense of the Python Language, but e.g.,
"*(1,2), "
is. (A comma is trailing.) Please check the definitions here:

https://docs.python.org/3/reference/expressions.html#expression-lists

For instance, "(*(1,2) )" raises SyntaxError.

Now, is "1,2," more boxed up than "*(1,2)," is? The *current* rule
surely says the former is a tuple at some places and the latter
is not, but otherwise, I don't see any parenthesis nor bracket around
"1,2,". May more parentheses than brackets visible there? I see commas
in both, so that's not the difference. Is there no way "*(1,2)," could
equally be boxed up at exactly the same places where "1,2," can?

Importantly, what problem may be caused by this in practice, or from
what problem does SyntaxError currently raised there save us? For
instance, if someone writes "s[*(1,2),]" in fact wanting
"s[ [*(1,2),] ]" but forgets to box up "*(1,2),", then the same thing
can happen for "s[ [1,2,] ]" (i.e., it can be mistyped as "s[1,2,]"
but without SyntaxError this time). It would at least be consistent if
we got SyntaxError in both cases (namely, the syntax allowed only a
single Python expression here), but if we don't want SyntaxError in
the latter case, how may we want it in the former case?

By the way, please note I wish "*(1,2)," to be treated like "1,2,"
only where the current syntax expects an expression list. Elsewhere, I
don't
mind it if starred expressions remain treated as unboxed or whatever.

Best regards,
Takuo
_______________________________________________
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/RKTLNFTKVRUPVEUIINGBO72EENX4MYH3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to