Hacking the Python AST
Suhas is a data scientist, full stack engineer, and a design hacker originally from Bangalore, India. He is currently a data engineer at Zalando SE, Berlin. Earlier, he has designed and built big data solutions for some of the Fortune 500 companies.
He is also the founder and curator of a data visualization and art museum called LifeWithData.
Computer languages are a remarkable feat of human scientific engineering. In this talk, we'll look at the innards of CPython, and specifically learn how to modify and hack Abstract Syntax Trees (for world peace, of course).
Computer languages are a remarkable feat of human scientific engineering. In this talk, we'll look at the innards of CPython, and specifically learn how to modify Abstract Syntax Trees (for world peace, of course).
- [ 05 mins ] --- A brief intro to languages and compilers
- [ 05 mins ] --- CPython and parsing grammars
- [ 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 LL(1) parser
- 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