Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Fun with Python Abstract Syntax Trees - Code Analysis and Manipulation

PyCon Israel via YouTube

Overview

Learn about Python's Abstract Syntax Tree (AST) module in this 18-minute PyCon Israel conference talk that explores code analysis, alteration, and generation capabilities. Discover the AST module's structure, class hierarchy, and supported functions while focusing on recreating initial code through AST representation. Examine the challenges of transforming AST back into code and explore practical applications through hands-on examples, including automatic log insertion, code reordering, and mutant testing manipulations. Master the fundamentals of AST manipulation while understanding both its potential and limitations in Python development.

Syllabus

Introduction
Abstract Syntax Trees
Python
Preserve Source Code
The AST Model
Adding Nodes
If Invert
Preserve Original Source Code
Challenges

Taught by

PyCon Israel

Reviews

Start your review of Fun with Python Abstract Syntax Trees - Code Analysis and Manipulation

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.