[Python-ideas] ('blue', 'red', 'orange' if something, 'green')

Bruce Leban bruce at leapyear.org
Fri Apr 22 21:08:36 CEST 2011


On Fri, Apr 22, 2011 at 12:00 PM, MRAB <python at mrabarnett.plus.com> wrote:

>    if foo if bar: == if bar: if foo:
>>
>>    return foo if bar == if bar: return foo
>>
>>  I'm having a bit of trouble parsing those...


Sorry. I meant:

if foo if bar:

equivalent to:

if (foo if bar):

equivalent to:

if bar: if foo:

or more simply:

if bar and foo:


return foo if bar

equivalent to:

if bar: return foo


which I hope make it clear why I don't like them.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110422/c1d89a4a/attachment.html>


More information about the Python-ideas mailing list