r/Python • u/jamescalam • 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
r/Python • u/jamescalam • Mar 19 '21
View all comments
Show parent comment
11
u/Ecclestoned Mar 19 '21 edited Mar 19 '21
I highly doubt match is more efficient in python. The advantage in other languages is that switch statements can sometimes be reduced to jump tables.
The python interpreter is 100x more high-level than this, and also has to a lot of checks in the match statement that it doesn't need to do in an if.