[Python-ideas] ('blue', 'red', 'orange' if something, 'green')
Sturla Molden
sturla at molden.no
Mon Apr 25 01:18:17 CEST 2011
Den 23.04.2011 21:36, skrev Westley MartÃnez:
> No. This is a horrible idea.
Do you think so? ;-)
The most "beautiful" thing with this syntax is this:
After typing
foo = 'orange' if cond
or
foo = 'orange' if cond else pass
we don't know if accessing foo will raise a NameError or
not (not without checking cond that is). And we all know
what an uncaught exception might do (cf. Ariane 5).
Sturla
More information about the Python-ideas
mailing list