Ant wrote:

> 
>> # python 2.5
>> >>> a, b = "", 0
>> >>> a if False else b
>> 0
>> >>> a if True else b
>> ''
>>
>> Time to tear out that page. Really.
> 
> Not quite - 2.5 hasn't been released in its final version yet, and many
> projects I should imagine will take a while to upgrade.

Ok, use

if cond:
   value = ... # expression that must not be evaluated unless it absolutely 
               # has to be
else:
   value = ... # same thing

which will withstand the test of time. Now tear out that page...

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to