Conditional operator in Python?

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Tue Sep 4 04:25:43 EDT 2001


Tue, 04 Sep 2001 09:09:38 +0200, Weet Vanniks <Weet.Vanniks at el_simpatico.be> pisze:

> What about :
> 
> def cond_choose(cond,first_choice,second_choice):
>      if cond:
>           return first_choice
>      return second_choice

This evaluates both alternatives in all cases.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list