(no) fast boolean evaluation ?

Neil Cerutti horpner at yahoo.com
Fri Aug 3 13:07:47 EDT 2007


On 2007-08-03, Ed Leafe <ed at leafe.com> wrote:
> On Aug 3, 2007, at 11:57 AM, Bruno Desthuilliers wrote:
>
>> Sorry, I forgot to mention the language did not allow to have else  
>> & if
>> in the same statement. IOW :
>>
>> if some_condition then
>>    do_sometehing
>> else
>>    if some_other_condition then
>>      do_something_else
>>    else
>>      if yet_another_condition then
>>        do_yet_another_thing
>>      else
>>        if your_still_here then
>>           give_up('this language is definitively brain dead')
>>        end if
>>      end if
>>    end if
>> end if
>
> Usually that's because the language provides a switch/case
> statement  construct. If it does and you try to write the above
> code, it isn't  the language that's brain-dead!  ;-)

The switch statements I'm aware of are less generally applicable
than a tower of "if { else if }* else". For example, with a
switch statement you have to dispatch on the one value for every
case.

In some languages, it's even of more limited, e.g., C, which can
switch on only integers.

-- 
Neil Cerutti
Next Sunday Mrs. Vinson will be soloist for the morning service. The pastor
will then speak on "It's a Terrible Experience." --Church Bulletin Blooper



More information about the Python-list mailing list