FW: [Python-Dev] conditional expressions?

Markus Schaber markus at schabi.de
Tue Oct 16 08:11:10 EDT 2001


Hi,

William Park <opengeometry at yahoo.ca> schrub:

>> > > A conditional expression analogy to list comprehensions would be
>> > > x = (a if b else c)
>>
>> You can also remove the parentheses, and not have to worry about the
>> "if" starting a new line.
> 
> I believe Perl and Ruby has
>     x = a if b

What does this do? Is it a conditional assignment?

Should rather be spelled like
  
  x if= a, b

:-)

markus

-- 
You don't have to be Microsoft to suck... but it helps.
(Tim Hammerquist in comp.lang.python)



More information about the Python-list mailing list