a = b = 1 just syntactic sugar?
Martin v. Löwis
martin at v.loewis.de
Sun Jun 8 08:31:42 CEST 2003
Ed Avis <ed at membled.com> writes:
> >What is the output of
> > print a,lambda:print b,c
> As I mentioned elsewhere in this thread, the lambda definition could
> be parenthesized where the parse would otherwise be ambiguous. But if
> parentheses aren't needed they could be left out.
That doesn't answer my question. What would be the output of this
> Is it a rule of Python's grammar that no construct should ever require
> parenthesizing just to stop it being ambiguous?
No, there is no such rule. Within expression, grouping is determined
by precedence: a*b+c is not ambiguous, since * has higher precedence
> But if there is not such a rule, I don't see the problem.
The 'problem', at the moment, is that you fail to specify what exactly
the grammar is that you are proposing. Then, if you have completed the
specification, the problem likely is that your proposed grammar is
either counter-intuitive, or unimplementable (depending on your
More information about the Python-list