If so, expect an influx of applications misusing switches in replacement of if.
If so, expect an influx of applications misusing switches in replacement of if.
Pattern matching is a great language feature but I've been watching the development of it for Python for a while and have felt nothing but horror.
If you want a great example of how it can be useful and how clear and elegant it can be, check out how it's done in Elixir [0].
There are many other languages that implement it in great ways, I'm sure others will comment on them.
[0] https://elixir-lang.org/getting-started/pattern-matching.htm...
[1] https://www.reddit.com/r/programming/comments/lgqhmj/stack_o...
If you want to see what it _really_ should look like, see Erlang, and then look at Prolog.
Structural pattern matching is a lot more than just switch/case, and I while I think pythons implementation looks imperfect, it will still be an amazing boon to the language.
There are a few gotcha-edge cases, but they are of the kind that are obvious once you've encountered them once.
I already know a couple dozen functions in my projects that I'm going to refactor to a fraction of their current length and improve the readability of at the same time as soon as this lands.