~/talk

The AST and Me

Talkat PyCon 2018 · on Friday, 2018-05-11· [python, developer-experience]
slides:none on file

Python source parses to an AST that the compiler transforms into a control‑flow graph and immutable code objects (look at co_consts and co_code), then emits bytecode stored in .pyc files. Use the built‑ins ast module to inspect/modify trees and dis module to read opcodes. Expect small compiler tweaks like peephole optimization and constant folding; larger speedups require alternate implementations. Real results: code generators, linters and formatters (Hypothesis, Jinja, black), and transpilers that actually run.

AI-written summary · about

  1. 0:00Introduction
  2. 2:06Python compiled or interpreted
  3. 2:44Process overview
  4. 3:45What is an AST
  5. 4:04What is a tree
  6. 6:46AST Parse
  7. 8:44Code Objects
  8. 15:37Constant Folding
  9. 16:29How the AST affects your code
  10. 17:52Examples of AST projects
  11. 21:36Conclusion
~/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.