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

Erik Max Francis max at alcyone.com
Sat Feb 8 05:52:08 EST 2003


Paul Rubin wrote:

> You know, if the inspiration for this syntax (condition in the middle)
> is list comprehensions, maybe the thing can be improved by requiring
> parentheses around the expression:
> 
>   (x if is_special(x) else y)
> 
> For some reason I find that clearer than the same thing without the
> parens.

Fortunately, whether they're required or not, you can always insert them
yourself as a matter of style.  I don't think they should be required
but imagine myself using surrounding parentheses often.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ If anything is sacred, the human body is sacred.
\__/ Walt Whitman
    ZOE / http://www.alcyone.com/pyos/zoe/
 A simple Python OpenGL rendering engine.




More information about the Python-list mailing list