Skip to content

Instantly share code, notes, and snippets.

@adow
Last active November 29, 2015 01:48
Show Gist options
  • Save adow/a854489b4cdbd02c7762 to your computer and use it in GitHub Desktop.
Save adow/a854489b4cdbd02c7762 to your computer and use it in GitHub Desktop.
python switch
result = {
'a': lambda x: x * 5,
'b': lambda x: x + 7,
'c': lambda x: x - 2
}.get(value,'')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment