[issue36765] Invalid grammar for f_expression

New submission from Kasra Vand <kasraavand@gmail.com>: Due to the discussion in following SO question https://stackoverflow.com/questions/55933956/what-does-a-star-asterisk-do-in... and the inconsistency of the source behaviour with the documentation I think using `"*" or_expr` for f_expression is wrong or at least not what it meant to be and very vague. I was wondering if there's any reason for using `"*" or_expr`. ---------- assignee: docs@python components: Documentation messages: 341186 nosy: Kasra Vand, docs@python priority: normal severity: normal status: open title: Invalid grammar for f_expression type: behavior versions: Python 3.7 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36765> _______________________________________

Kasra Vand <kasraavand@gmail.com> added the comment: Due to the discussion in following SO question https://stackoverflow.com/questions/55933956/what-does-a-star-asterisk-do-in... and the inconsistency of the source behaviour with the documentation I think using `"*" or_expr` for f_expression is wrong or at least not what it meant to be and very vague. I was wondering if there's any reason for using `"*" or_expr` instead of let's say just `expr` which I think is what the `or_expr` identifier is intended to be. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36765> _______________________________________

Change by Karthikeyan Singaravelan <tir.karthi@gmail.com>: ---------- nosy: +eric.smith _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36765> _______________________________________

Eric V. Smith <eric@trueblade.com> added the comment: I don't think this is a problem. There are plenty of things allowed by Python's grammar that are converted to errors in subsequent passes. For example:
*[1] File "<stdin>", line 1 SyntaxError: can't use starred expression here *[1],*[2] (1, 2)
---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36765> _______________________________________

Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: Concur with Eric. The formal definition of the Python grammar is wider than valid Python, because we do not want to make it too complex. Invalid constructions are filtered out later. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36765> _______________________________________

Eric V. Smith <eric@trueblade.com> added the comment: Thanks, Serhiy. I suppose that we could add a note to the documentation, but I'm not sure it would be worth the confusion it would create. It's best to think of this is "it's just an expression, like everywhere else in Python". If I ever decide I like PEP 536, maybe then things will become clearer (although possibly not: the same issue will still exist, but I think it will become more obvious that expressions are treated just like they are elsewhere). So I'm going to close this. ---------- resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36765> _______________________________________
participants (4)
-
Eric V. Smith
-
Karthikeyan Singaravelan
-
Kasra Vand
-
Serhiy Storchaka