Skip to content

Instantly share code, notes, and snippets.

@acdimalev
Created February 25, 2018 04:03
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 acdimalev/91e365fda95f1d012198e9e1e1910a13 to your computer and use it in GitHub Desktop.
Save acdimalev/91e365fda95f1d012198e9e1e1910a13 to your computer and use it in GitHub Desktop.
"""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