Created
June 25, 2020 01:58
-
-
Save rvente/099ea7975fbffd1d8157ed1658f0ec3d to your computer and use it in GitHub Desktop.
PEP 622 proposal of match-case syntax https://www.python.org/dev/peps/pep-0622/#performance-considerations
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
match number: | |
case 0: | |
print("Nothing") | |
case 1: | |
print("Just one") | |
case 2: | |
print("A couple") | |
case -1: | |
print("One less than nothing") | |
case 1-1j: | |
print("Good luck with that...") | |
match greeting: | |
case "": | |
print("Hello!") | |
case name: | |
print(f"Hi {name}!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment