Another conditional expression candidate (PEP 308)
Anders J. Munch
andersjm at inbound.dk
Mon Feb 10 12:24:43 EST 2003
"Andrew Koenig" <ark at research.att.com> 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 news010.worldonline.dk>.
- Anders
More information about the Python-list
mailing list