Created
February 22, 2018 06:08
-
-
Save anonymous/a5ed3953e28440b4368c338b1e19d294 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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