Nick Coghlan added the comment: To clarify how my patch works: leaving out the parentheses is permitted *only* when the call is a statement unto itself. That's how it avoids conflicting with any existing syntax like "a *b" or "a **b": the parser consumes those as part of the initial expression, so you *need* the parens to control precedence and get it interpreted as a call instead. It was surprisingly elegant at the implementation level - once I got the new expr_stmt definition and parsing right, everything later in the chain "just worked".
A real patch might want to look at the following enhancements: * constraining the LHS further. This needs to happen at the AST construction stage, since the parser can't look far enough ahead to limit it. The patch currently uses the same rules as augmented assignment targets * constraining the RHS. For example, disallowing generator expressions, so they need to use the parenthesised form. * adding an AST node for clean source-to-source transformations * allowing implicit calls in more places. For example, as an assignment value, or a return value. Proving it was possible at all with pgen scratched my itch, so someone else will need to run with it for it to turn into a concrete proposal that addresses the readability issues. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18788> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com