Skip to content

Instantly share code, notes, and snippets.

Created February 22, 2018 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/a5ed3953e28440b4368c338b1e19d294 to your computer and use it in GitHub Desktop.
Save anonymous/a5ed3953e28440b4368c338b1e19d294 to your computer and use it in GitHub Desktop.
def foo1(option):
if option is not 'case1':
return
print("foo1 running...")
return 1
def foo2(option):
if option is not 'case2':
return
print("foo2 running...")
return 2
def foo3(option):
if option is not 'case3':
return
print("foo3 running...")
return 3
def default(option):
if option is not 'default':
return
print("default running...")
return 0
option="case3"
result = {
'case1': foo1(option),
'case2': foo2(option),
'case3': foo3(option),
'default': default(option),
}.get(option)
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment