Created
February 25, 2018 04:03
-
-
Save acdimalev/91e365fda95f1d012198e9e1e1910a13 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
"""Demonstration of an embedded match statement that does not behave properly. | |
This program should print... | |
--- | |
one | |
--- | |
two | |
--- | |
three | |
But it actually prints... | |
--- | |
one | |
--- | |
two | |
three | |
--- | |
three | |
""" | |
def printval(a, b): | |
print("---") | |
case a: | |
match False: | |
match False in b: | |
print("one") | |
else: | |
print("two") | |
match True: | |
print("three") | |
def main(): | |
[ | |
printval(a, b) | |
for a, b in [ | |
(False, False), | |
(False, True), | |
(True, False), | |
] | |
] | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment