Diving Deep into Python's Abstract Syntax Tree with Emily Morehouse

At PyCon 2018, Cuttlesoft's Director of Engineering, Emily Morehouse, spoke to a packed Cleveland conference hall full of Python professionals and fans. The room fell silent with anticipation as Emily prepared to unravel the mysteries of Python's Abstract Syntax Tree (AST) in her talk titled "The AST and Me."

Understanding the Python Code Lifecycle

For many people, the path of Python code is a mystery. Python code goes through many changes from source code to its ultimate execution. Emily stressed the value of comprehending the inner workings of the language while giving guests a unique look into this process.

"Python is both a compiled and an interpreted language"

This duality is what makes Python beautiful and complex. The phases that Python code goes through are tokenization, parsing, abstract syntax tree conversion, bytecode production, and eventually execution in the Python virtual machine.

The Magic of the Abstract Syntax Tree

Emily's thorough explanation of the Abstract Syntax Tree (AST) was the talk's high point. An AST is a simplified tree-like representation of code by definition. Each node in this tree represents a specific language construct, providing a clear structural representation of the code.

"Think of the AST as a more distilled version of the parse tree, which retains all information, including comments, from the source code,"

By simplifying and organizing the source code, ASTs offer developers a powerful tool to interact with and comprehend the underlying semantics of the code.

Optimizing Python Compilation

Another noteworthy aspect of the talk was Emily's insights into the current optimizations in Python's compilation process. By understanding these optimizations, developers can write more efficient code and fully utilize the power of Python.

Harnessing the Power of ASTs

Emily demonstrated various ways developers can use ASTs to build powerful tools. Drawing from her vast experience at Cuttlesoft, she showcased real-world applications of ASTs and encouraged fellow developers to embark on this journey of exploration.

"By grasping the intricacies of the Abstract Syntax Tree, developers open doors to creating more efficient, powerful, and innovative tools"

Slides for Emily's talk can be found at: https://speakerdeck.com/pycon2018 and https://github.com/PyCon/2018-slides.

Related Posts

AWS logo centered over dark blue stylized map of Europe with concentric radar-style rings emanating from Germany, representing the AWS European Sovereign Cloud infrastructure launch for EU data sovereignty and GDPR compliance
January 26, 2026 • Frank Valcarcel

AWS Launches European Sovereign Cloud

AWS launched a physically separate cloud infrastructure in Europe with EU-only governance, zero US dependencies, and over 90 services. Here is what organizations in healthcare, finance, and government need to know about the sovereign cloud and how to evaluate it for their compliance strategy.

Blueprint-style architecture diagram of an AI agent framework showing the core orchestration loop of observe, think, act, and repeat, with components for planning, state management, LLM reasoning, tool execution, and persistent memory connected by directional data flows on a dark grid background.
March 27, 2025 • Frank Valcarcel

A Practical Guide to Agent Orchestration Frameworks

There are at least a dozen frameworks competing to be the foundation for your agent architecture. This post breaks down how each one thinks about the problem, where it shines, and where it will cost you time. We are not ranking them. The right choice depends on your use case.

Let's work together

Tell us about your project and how Cuttlesoft can help. Schedule a consultation with one of our experts today.

Contact Us