Saturday August 25 2018, C3.6, 14:50 AEST


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 need to 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.


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.


Watch 'Refactoring Code With the Standard Library' on PyCon AU's YouTube account

John Reese

John Reese
Facebook
@n7cmdr
https://jreese.sh


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.