Author terry.reedy
Recipients Brando753, docs@python, terry.reedy
Date 2020-11-14.10:54:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605351298.14.0.801521641188.issue42316@roundup.psfhosted.org>
In-reply-to
Content
PEP 572 does not saw much of anything about when parens are needed.  Nor does the low priority itself.  Looking through the grammar of expressions, an assignment_expression is also a starred_expression, a positional_item (in calls), and the first part of a comprehension. It is not itself an plain expression unless and until wrapped in parentheses.  Subscription requires an expression list, which may be a single expression.

To put it another way: an expression is an assignment expression but an assignment expression with a "name :=" prefix is not an expression, so parens are required anywhere an expression is required.  That includes subscripts, slicings, displays, call items other than positional items, comprehension parts other than the initial expression (maybe, check), parts of conditional expressions (maybe, check), and lambda expression bodies.  After checking, I would like a sentence added to the doc before the 'go see the PEP' bit.

This has nothing to do with asyncio.
History
Date User Action Args
2020-11-14 10:54:58terry.reedysetrecipients: + terry.reedy, docs@python, Brando753
2020-11-14 10:54:58terry.reedysetmessageid: <1605351298.14.0.801521641188.issue42316@roundup.psfhosted.org>
2020-11-14 10:54:58terry.reedylinkissue42316 messages
2020-11-14 10:54:57terry.reedycreate