~/talk

Structural Pattern Matching in Python

Talkat XtremePython 2021 · 2021-11-25..11-28· [python]
slides:none on file

Concrete walkthrough of Python structural pattern matching shows match/case with wildcard _ and sequence patterns used to implement CLI-style command parsing where the first token selects behavior and the rest pack via a starred capture. It demonstrates literal, capture, OR and as patterns, guards (if), class patterns for dataclasses and classes using __match_args to control attribute order, enum value matching, dict key matching with **rest, and type checks using builtins like str — all examples compile and behave as described.

AI-written summary · about

  1. 0:00Introduction to pattern
  2. 2:00Wildcards and sequences
  3. 4:20Structural pattern design
  4. 7:42Composition and capture
  5. 9:43Advanced pattern operators
  6. 12:22Guards and object matching
  7. 16:16Dataclass matching
  8. 20:11Enum and complex patterns
  9. 22:10Dictionary matching
  10. 24:46Type validation
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.