Dynamic Pattern Matching with Python
summary
Pattern matching lands in Python 3.10 as a structural matcher that binds names as local variables (function scope only), provides positional patterns plus class-driven and explicit mappings for objects, and defers powerful active extractors to future work. The implementation adds new bytecode and a sequence matcher that does not consume iterators so failed matches can backtrack. The feature is shipped but provokes community tradeoffs on syntax and will take years to reach wide adoption across distributions.
AI-written summary · about
chapters (12)
- 0:00Dynamic pattern matching intro
- 2:28Why Python needed it
- 6:26Core concepts
- 12:28Pattern matching vs switch
- 13:10Dynamic objects challenges
- 20:43Solutions for dynamic objects
- 22:32Python 3.10 implementation
- 25:03Community resistance
- 26:08Adoption metrics
- 28:39Teaching pattern matching
- 30:47Implementation details
- 33:16Closing remarks
related talks
16mDynamic Pattern Matching with Python
24mA Perfect Match The history, design, implementation, and future of Python's...
26mStructural Pattern Matching in Python
10mAn Exploration of Python's Upcoming Match Statement
26mThe Road to Pattern Matching in Python
30mAdvanced parsing of structured data using Python's new match statement
42mMatch Case for Beginners
46mSupercharge your code with Python's 'match' statement
