"Structural pattern matching" for Python, part 1
"Structural pattern matching" for Python, part 1
Posted Aug 6, 2020 18:51 UTC (Thu) by intgr (subscriber, #39733)In reply to: "Structural pattern matching" for Python, part 1 by logang
Parent article: "Structural pattern matching" for Python, part 1
I agree that's the best way to write it currently. But getting rid of such verbose "inverted logic" checking code is the reason why I'm very excited for Python's match/destructuring syntax.
Every piece of criticism by mb is spot on, however. The syntax needs to be redesigned.
After some dabbling in Rust, I'm now convinced that pattern matching is a feature that every modern language should have. I've also found the destructuring features of TypeScript (JavaScript) very helpful, Python has been lagging behind but pattern matching would catch up with and surpass what they have to offer.
The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:
Note: you can avoid this step in the future by logging into your LWN account.
