Ternary Operator

Roman Suzi rnd at onego.ru
Fri May 18 12:36:44 EDT 2001


On Fri, 18 May 2001, Marco Mariani wrote:

>On Fri, May 18, 2001 at 05:45:27PM +0200, Stefan Kirchberg wrote:
>
>> Now, how about
>>         [b,c][not a]
>> -?
>
>Done for ages, works well.

It's not the same as

if a:
   return b
else:
   return c

- because both b and c are calculated!


(a and b) or c

_almost_ do the job

Sincerely yours, Roman Suzi
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Friday, May 18, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "Nunnery - Where nuns are hatched" _/





More information about the Python-list mailing list