~/talk

Code as Data_ A Practical Introduction to Python’s Abstract Syntax Tree

Talkat PyData Paris 2025 · 2025-09-30..10-01· [python]
linkedin:direr
slides:none on file

Shows a concrete claim: Python’s ast lets code be rewritten so pytest prints intermediate values instead of a bare AssertionError, by rewrites assert into intermediate variables that get printed in a try or boolean wrapper. Demonstrates tools that use this — pytest, linters, black, pandas query tweaks, dask and template engines like Ginga 2 — and practical limits: ast drops formatting and comments and AST shapes change across Python versions, yet the transformer example actually works and pytest uses @-named temps in its transformed trees.

AI-written summary · about

  1. 0:00Introduction to abstract syntax trees
  2. 3:35Python execution flow
  3. 7:56Pytest AST errors
  4. 12:44Poor man's pytest
  5. 18:51Pytest assertions AST
  6. 21:00AST in tools
  7. 22:45AST refactoring
  8. 26:38Why AST matters
  9. 27:01Q&A
~/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.