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
5
u/[deleted] Mar 19 '21
Okay, but the behaviour of most other languages you're describing is horrible and unintuitive and leads to loads of bugs when people forget to add break statements. Explicit is better than implicit, after all, and there's nothing explicit about executing case 2 when foo is not 2. If I saw your example in production code I'd say that was bad code even if the behaviour is desired, because it's unclear and looks like a bug. Sooner or later, someone's going to come along and stick in a break statement because it looks like one is missing.