r/Python • • Mar 19 '21

Match is more than a Switch-Case The New Switch-Case Statement in Python 3.10

https://youtube.com/watch?v=2qJavL-VX9Y&feature=share
1.4k Upvotes

233 comments sorted by

View all comments

1

u/[deleted] Mar 20 '21

Python is becoming JS and JS is becoming Python

3

u/xigoi Mar 20 '21

Since when does JS have pattern matching?

0

u/[deleted] Mar 20 '21

1990s i think

2

u/xigoi Mar 20 '21

Really? Can you show me how to do the equivalent of this?

match point:
    case (0, 0):
        print("origin")
    case (0, y):
        print(f"{y} on the y-axis")
    case (x, 0):
        print(f"{x} on the x-axis")
    case (x, y):
        print(f"({x}, {y})")
→ More replies (5)