Published Jun 21, 2022

Episode 517: Jordan Adler on Code Generators

Jordan Adler delves into Pinterest's seamless Python 2 to 3 migration, offering deep insights into code transformation and generation strategies, emphasizing incremental changes and effective handling of complex, large-scale projects to maintain code functionality and efficiency.
Episode Highlights
Software Engineering Radio - the podcast for professional software developers logo

Popular Clips

Episode Highlights

  • Migration Process

    Pinterest's transition from Python 2 to Python 3 was a meticulous process, leveraging tools like Python Future to facilitate the migration. explains that Python Future, developed by Python Charmers, includes code transformers that modify Python 2 code to be more compatible with Python 3 1. This approach allowed Pinterest to gradually implement changes without disrupting existing functionalities. notes, "You can migrate while using features that would typically not be available on Python two or specifically the API that changes under Python three" 2. By running Python 2 code with Python 3 behaviors, Pinterest ensured a smoother transition, ultimately leading to a cleaner, fully Python 3 codebase.

       

    Migration Tools

    The migration at Pinterest was heavily reliant on the Python Future tool, which utilizes the AST (Abstract Syntax Tree) class from the Python standard library. describes how this tool reads and transforms code by identifying specific nodes, such as function calls, and modifying them as needed 3. This method is particularly effective for interpreted languages like Python, which can model code within the language itself. highlights, "Most compiled languages don't have some version of this," emphasizing the unique capabilities of Python in facilitating such transformations 3. This approach allowed Pinterest to efficiently manage the complexities of their codebase during the migration.

Related Episodes