~/talk

Digging into Abstract Syntax Trees for analyzing and modifying Python programs

Talkat PyOhio 2014 · 2014-07-26..07-27· [compilers-and-language-design]
links:none on file
slides:none on file

Shows how to parse source with inspect.getsource and ast.parse, walk trees with ast.NodeVisitor to collect defined vs called names using set difference, and transform code with ast.NodeTransformer to inject print nodes and recompile to bytecode. Builds python-morg to find dead code and deletes roughly 150–200 unused functions, mentions macro_py for safer macro-like rewrites and mutation testing for fuzzing unit-test coverage.

AI-written summary · about

  1. 0:00Start
  2. 0:40Can You Write a Python Program That Takes a Python Program as Input
  3. 0:59Abstract Syntax Trees
  4. 2:39Abstract Syntax Trees
  5. 3:50Node Visitor and Node Transformer
  6. 5:11Node Visitor
  7. 6:52Convenience Method Dump
  8. 24:17Mutation Testing
~/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.