[Tutor] Re: case/switch, etc.

Magnus Lycka magnus@thinkware.se
Fri, 11 Oct 2002 20:50:02 +0200


There are also simpler cases where
dicts are an obvious choice:

switch x
case xx
    a =3D 1
case yy
    a =3D 2
etc...

Here you can simply do:

a =3D {xx:1, yy:2 ...}[x]

All in all, I find python much more powerful.

Another (semi-related issue) is how you
can use 'and' and 'or' instead of 'if' or
a C construct like "a?x:y"


--=20
Magnus Lyck=E5, Thinkware AB
=C4lvans v=E4g 99, SE-907 50 UME=C5
tel: 070-582 80 65, fax: 070-612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se