decision tables Re: Another stab at a "switch/case" construct (new proposal):
Gerson Kurz
gerson.kurz at t-online.de
Sat Mar 30 01:32:56 EST 2002
On Sat, 30 Mar 2002 08:33:13 +0300 (MSK), Roman Suzi <rnd at onego.ru>
wrote:
>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
just an idea: subclass dict, implement pattern matching in the lookup
func?
derived_dict(
(0,0,2) : do1,
(0,1,0) : do2,
(0,1,1) : do3,
(1,2,2) : do4
)
with lookup
d[F1,F2,F3](args)
More information about the Python-list
mailing list