|
From: | Aaron Bentley |
Subject: | Re: [Gnu-arch-users] Unable to 'tla get' from public mirror -- PANIC: I/O error |
Date: | Wed, 15 Sep 2004 19:21:59 -0400 |
User-agent: | Mozilla Thunderbird 0.5 (X11/20040306) |
James Blackwell wrote:
Meh. Why is it both perl and python both refuse to have switch statements? That is _so_ braindamaged.
Dictionaries make a great substitute for switch statements: # Not actually tested. def printer(input): def a_func(): print "You chose a!" def b_func(): print "You chose b!" {"a":a_func, "b":b_func}[input]()What's more, they're reusable-- heck, they can even be generated by or passed to other functions! I suppose now, someone will show us how to do it with lambdas.
Aaron
[Prev in Thread] | Current Thread | [Next in Thread] |