Hacking the Python AST
Suhas SG (~jargnar) |
Computer languages are a remarkable feat of human scientific engineering. In this talk, we'll look at the innards of Python, and specifically learn how to modify Abstract Syntax Trees (for world peace).
- [ 05 mins ] --- A brief intro to languages and compilers
- [ 05 mins ] --- CPython
- [ 10 mins ] --- Everything about Python ASTs
- [ 15 mins ] --- Let's write a flake8 plugin (to understand ASTs better)
- [ 05 mins ] --- Metaprogramming, code as data, possibilities and more!
What we'll learn
- We'll learn the life of a python code, and how the CPython process works.
- We'll understand and be able to participate in conversations that include words like
- We'll make our devious minds work towards hacking into source code and modifying it with the help of ast.NodeTransformer
- We'll learn to write a Flake8 plugin
- A treasure map to dive into deeper waters
- Basics of Python, must be comfortable with lists, functions, classes
- Basic idea / understanding of data structures
- A mischievous mind to get hands dirty for intercepting source code and parsing ASTs
- A bottle of water to keep yourself hydrated