PEP 308: Alternative conditional operator forms

Anders J. Munch andersjm at dancontrol.dk
Tue Feb 11 13:22:31 EST 2003


"Erik Max Francis" <max at alcyone.com> wrote:
> The immediate reaction to this is that it doesn't seem fair in cases
> like:
>
> f((x if C else y))
>
> (without the doubled parentheses, it would be illegal).  If you want to
> special-case that one, then the grammar gets more complicated and
> eventually you start wondering why the parentheses should be required
> anyway.

It doesn't particularly complicate the grammar to require parentheses
but allow
  f(x if C else y)
It may even be simpler than not requiring parentheses because there's
no need to consider ambiguities with if statements and within list
comprehensions.

- Anders






More information about the Python-list mailing list