Created
November 12, 2013 08:25
-
-
Save chriszf/7427457 to your computer and use it in GitHub Desktop.
I thought python could use some new syntax...
This file contains hidden or 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
mac3:shenanigans czf$ cat 031_switchcase2.py | |
import lib.switchcase | |
def one(): | |
print "One branch executed" | |
def two(): | |
print "Two branch executed" | |
def three(): | |
print "Three branch executed" | |
some_var = 2 | |
switch(some_var, (one() for some_var in case(1)), | |
(two() for some_var in case(2)), | |
(three() for some_var in case(3))) | |
mac3:shenanigans czf$ python 031_switchcase2.py | |
Two branch executed | |
mac3:shenanigans czf$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment