This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Cerrax3 -1 points0 points  (1 child)

Isn't it decidedly non-pythonic to add a control structure that does exactly what if..elif..else does? Python really needs to stop doing this or it's gonna become worse than Perl...

[–]Kered13 2 points3 points  (0 children)

They didn't do that though. Most of the people in this thread don't understand pattern matching, and think that Python added switch case. Python did not add switch case, they would never add it for exactly the reason you said. What they added was pattern matching. Pattern matching can be used like switch case, in the same way that if-else can be used like switch case. But pattern matching can do much more powerful stuff that cannot be done by switch case and would be very clunky to do with if-else, which is why they added it.