PEP 308: Alternative conditional operator forms
Erik Max Francis
max at alcyone.com
Tue Feb 11 01:57:49 CET 2003
Robin Munn wrote:
> Almost, but not *quite*, what I wanted to suggest. I propose:
> (x if C else y) # Parentheses are *required*
> This is identical to the format proposed in PEP 308 with the exception
> that parentheses are required around the ternary expression.
The immediate reaction to this is that it doesn't seem fair in cases
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
Use parentheses for clarity, sure. _Require_ them, I don't see.
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ Whoever contends with the great sheds his own blood.
Polly Wanna Cracka? / http://www.pollywannacracka.com/
The Internet resource for interracial relationships.
More information about the Python-list