Another conditional expression candidate (PEP 308)

Anders J. Munch andersjm at
Mon Feb 10 18:24:43 CET 2003

"Andrew Koenig" <ark at> wrote:
> I don't see any reason for the parens to be mandatory.
> In particular, I don't see any reason why I should not be
> able to write
>         foo(if a > 0: 'positive' elif a == 0: 'zero' else: 'negative')

Mandatory parentheses doesn't mean there has to be a grammar
production that goes "if_expr ::= '(' 'if' ... ')'".

This particular example is enclosed in parens.  And is therefore
accepted by the grammar changes proposed in
<news:EEb1a.63692$Hl6.7229914 at>.

- Anders

More information about the Python-list mailing list