Navigation
Search
|
Hoyt: Structural pattern matching in Python 3.10
Tuesday September 21, 2021. 12:40 AM , from LWN.net
Ben Hoyt has published a critical
overview of the Python 3.10 pattern-matching feature. As shown above, there are cases where match really shines. But they are few and far between, mostly when handling syntax trees and writing parsers. A lot of code does have if ... elif chains, but these are often either plain switch-on-value, where elif works almost as well, or the conditions they’re testing are a more complex combination of tests that don’t fit into case patterns (unless you use awkward case _ if cond clauses, but that’s strictly worse than elif). (Pattern matching has been covered here as well).
https://lwn.net/Articles/869883/rss
|
25 sources
Current Date
Apr, Fri 26 - 14:46 CEST
|