๐Ÿ‡บ๐Ÿ‡ธ Fun With ASTs

Calendar Icon - Evently Webflow Template
04 July
Clock Icon - Evently Webflow Template
ย -ย 

About the Session

The AST (Abstract Syntax Tree) module in Python can be used to analyze code, alert it, and even generate new code. We can use programming to change the AST representation of python, resulting in code that looks and behaves differently than the original. This is a really cool thing to do. In this talk we will explore the AST module capabilities, and its lack of capabilities. We will learn the general structure of ASTmodule, its class hierarchy and its supported functions. Our focus will be on acquiring the skill to recreate the initial code through its AST representation. It seems that even though transforming python code into an AST is a simple task, the inverse process of transforming AST into code fails to replicate the original code.We will see some examples of fun code-manipulations. First, we will show how to automatically add meaningful logs to your code. Second, we will experiment with code reordering and last, we will explore ideas to manipulate code for mutant testing purposes.