Please Log In to save to favorites
TAGs
python, switch, case


Versions
Switch equivalent statement in python
Switch statement in Python - taken from http://simonwillison.net/2004/May/7/switch/
      
    1.   result = {
    2.    'a': lambda x: x * 5,
    3.    'b': lambda x: x + 7,
    4.    'c': lambda x: x - 2
    5.   }[value](x)
Comments