~/talk

Hacking the Python AST

Talkat PyCon.DE 2017 · 2017-10-25..10-27· [python]
name:Suhas SG
links:none on file
slides:none on file

Clones CPython from GitHub and edits its grammar and AST pipeline to prove changes take effect at runtime, using the stdlib ast module with ast.NodeVisitor and ast.NodeTransformer to traverse and rewrite code. Builds a flake8 plugin that emits a custom X9000 error for single-letter function names. Demonstrations include renaming variables across code, mapping names to dictionary lookups, and a live parser modification that makes localized keywords behave differently — all shown working on an actual Python build.

AI-written summary · about

  1. 0:00Introduction and setup
  2. 3:53Philosophy of hacking
  3. 10:36Compiler architecture
  4. 14:34Python internals
  5. 16:22Grammar and LL(1)
  6. 20:34Bytecode experimentation
  7. 23:07AST manipulation
  8. 28:08Building custom tools
  9. 33:56Q&A and conclusion
~/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.