this is a good article about the new structural pattern matching feature in 3.10: https://benhoyt.com/writings/python-pattern-matching/ demonstrating its benefits and discussing its drawbacks. the way that variable names and class function calls are "overloaded" inside of case statements is not super intuitive imo
@aparrish "But does the feature provide enough value to justify the complexity, not to mention the cognitive burden it places on people learning Python or reading Python code?"
@aparrish Having used structural matching in Clojure and Rust, I am *delighted* to see it coming to Python. It's incredibly powerful and, unless overused, is much more readable than the corresponding imperative code.
The other thing I'd like to see (and maybe it's already there, or on the way?) is destructuring assignment -- effectively, just one of these case arms, and grabbing things out of a nested data structure and binding them to locals.
@aparrish I had just read an article on programming in Fortran in the 70's and the new structural case matching in Python reminds me of "computed GOTO". The code becomes harder to read if you have to run a computation to see what the case select ACTUALLY says.
Hometown is adapted from Mastodon, a decentralized social network with no ads, no corporate surveillance, and ethical design.