~/talk

Advanced parsing of structured data using Python's new match statement

Talkat PyCon Italia 2024 · 2024-05-22..05-25· [python, compilers-and-language-design]
links:none on file
slides:none on file

Demonstrates using Python 3.10+ pattern matching to parse real data and to transform code by scanning ASTs with inspect and ast, building an automatic refactor that turns isinstance if‑chains into match nodes and it works on functions with a single match variable. Benchmarks show match is about 2× slower than equivalent if checks except a surprising win on a list-of-integers case, and an inline capture form is markedly slower than explicit capture. Examples include parsing JSON, XML (ElementTree/element-style objects) and ASTs.

AI-written summary · about

  1. 0:00Introduction to match
  2. 1:43Advanced pattern matching
  3. 4:34Adoption and documentation
  4. 6:27Parsing applications
  5. 25:14Benchmarking performance
  6. 26:50Conclusion and resources
  7. 28:01Q&A session
~/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.