Navigation
Recherche
|
Hoyt: Structural pattern matching in Python 3.10
mardi 21 septembre 2021, 00:40 , par 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
|
56 sources (32 en français)
Date Actuelle
mar. 7 mai - 05:24 CEST
|