Author ncoghlan
Recipients Ramchandra Apte, alex, ezio.melotti, gvanrossum, ncoghlan, peter.otten, pitrou, serhiy.storchaka
Date 2013-08-20.16:49:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CADiSq7dTzS0yZHzQhZFBdqjkD---NfG3sw4-Drk1HeOXBTF+QA@mail.gmail.com>
In-reply-to <1377012007.45.0.0795665512581.issue18788@psf.upfronthosting.co.za>
Content
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.
History
Date User Action Args
2013-08-20 16:49:15ncoghlansetrecipients: + ncoghlan, gvanrossum, peter.otten, pitrou, ezio.melotti, alex, Ramchandra Apte, serhiy.storchaka
2013-08-20 16:49:15ncoghlanlinkissue18788 messages
2013-08-20 16:49:14ncoghlancreate