decision tables Re: Another stab at a "switch/case" construct (new proposal):

Roman Suzi rnd at onego.ru
Sat Mar 30 00:33:13 EST 2002


On Fri, 29 Mar 2002, Chris Gonnerman wrote:

>----- Original Message -----
>From: "Cliff Wells" <logiplexsoftware at earthlink.net>
>>
>> Now which is cleaner?   I think the perceived need for this type of
>> construct is a holdover from thinking in other programming languages
>versus
>> thinking in Python.

if-elif-else is a complete functional substitute for any kind
of switch/case. I can't see why this topic is still discussed.
Python has dictionaries, so many simple things could be
made by them. More complex decision making pieces of code
could be elegantly done with if's.

*

However, I'd liked to see a good paradigm for expressing
decision tables like this one:

F1 F2 F3 R
0  0  *  do1
0  1  0  do2
0  1  1  do3
1  *  *  do4

in Python. (With lazy evaluation, of course).

Any ideas?

Sincerely yours, Roman Suzi
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Saturday, March 30, 2002 _/ Powered by Linux RedHat 6.2 _/
_/ "Answers: $1 * Correct answers: $5 * Dumb looks: Free! *" _/





More information about the Python-list mailing list