For review: PEP 308 - If-then-else expression

Anders J. Munch andersjm at dancontrol.dk
Tue Feb 11 03:45:18 EST 2003


"Erik Max Francis" <max at alcyone.com> wrote:
> "Anders J. Munch" wrote:
> 
> >  parenth_form ::=
> >               "(" [if_expr_list] ")"
> 
> I'm not sure why you need a special form for the parenthesized
> conditional.  Surely the conditional operator would itself simply be an
> expression, so it would be handled by a (presumably already existing)
> basic "(" expr ")" rule.

Just adding an expr production
    expr ::= "(" if_expr ")"
would not allow for
    f(if a: b else: c)
you would be required to write
    f((if a: b else: c))

- Anders






More information about the Python-list mailing list