Refactoring Code with the Standard Library
By John Reese

What if you could refactor your entire code base, safely and automatically? How much old code could you fix or replace if you didn't worry about updating every reference by hand? I'll show you how a concrete syntax tree (CST) can help you do just that using only the standard Python library.

Sunday 11:05 a.m.–11:35 a.m.

Python includes a concrete syntax tree (CST) in the standard library, useful for mass refactoring code bases of all sizes. I'll walk through the differences between abstract and concrete syntax trees (AST and CST), why a CST is useful for refactoring, and how you can build basic refactoring tools on top of a CST to modify your entire code base quickly and safely. Lastly, I'll demonstrate what's possible with these tools, including upgrading code to new interfaces, or wholesale movement of code between modules. This talk assumes a basic understanding of how Python works, but will otherwise provide enough context to be useful to those who haven't previously worked with syntax trees.

John Reese

I am a Production Engineer at Facebook working on our Python Foundation team, building tools and improving support for Python, both outside the company and within Facebook’s shared codebase. I’ve had the opportunity to learn and grow in multiple sectors of the industry over the past decade, including storage, telecommunications, network security, and video games.