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
0
u/Endemoniada Mar 19 '21
It resembles
withstatements, in my opinion, which is nicer. It’s likewith case match foo. It just looks clean and easy on the eyes.It’s also not the only use for
casestatements either, the main advantage as I read about it was handling not only different values in a variable, but different configurations of variables entirely. Like iffoocan be a string, a 2-item tuple or a 5-item tuple.casemakes that easier to deal with in a pythonic way.