Python and AST



As per Wikipedia AST

In computer science, an abstract syntax tree (AST), or just syntax tree, is a tree representation of the abstract syntactic structure of source code written in a programming language. Each node of the tree denotes a construct occurring in the source code.

In this talk I will discuss the different stages of python code life cycle. Then I will show the AST and Byte code stage for the code with the help of inbuilt AST module and go a bit deep in the topic with the code example and show how the optimization of code is done by interpreter.

After that I will talk about this python expression "False == False in [True]" and then try to explain the evaluation of this expression what the final result of the expression will be and how we get that result.

Then we will discuss different application of the AST and tools which are based on the AST.

Here is the outline of the talk (Total time - 30 mins)

-  Quick Intro of me and talk agenda [2m]
-  Bird eye view of the Python code life cycle [1m]
-  Discuss different stages of the Python code lifecycle [3m]
-  Take a Python code and show the different stages through which code passes.  [5m]
-  AST detailed explanation and talk about the inbuilt AST module in Python 3.X  [2m]
-  Talk about this expression "False == False in [True]" and how Python interprets this expression with help of AST [~10m]
-  Different tool and application based on AST [2m]
-  Q & A [5m]


  • A basic understanding of Python programming.

Video URL:

Speaker Info:

Sandeep Choudhary has over 4 years of programming experience. He loves to write code in Python and likes to be part of the FOSS community. He has been the part of the early team to build a SaaS based system for the Indian SMEs to help them with digitalization of their business.

Speaker Links:

  • Blog:
  • Twitter:
  • GitHub:

Section: Core Python
Type: Talks
Target Audience: Intermediate
Last Updated: