The Real Python Podcast

Advice for Writing Maintainable Python Code

89 snips
Nov 7, 2025
Christopher Trudeau, a key contributor to PyCoder’s Weekly, shares his insights on writing maintainable Python code. He delves into techniques for creating comments, meaningful names, and avoiding magic numbers. The discussion emphasizes the Single Responsibility Principle and promoting readability, while preparing code for future transformations. Additionally, Trudeau highlights innovations in the Python community, including comparisons between Polars and pandas, generating realistic test data, and the GUI toolkit, buttonpad for creating interactive applications.
Ask episode
AI Snips
Chapters
Books
Transcript
Episode notes
ADVICE

Customize The Python REPL Carefully

  • Use a Python startup file to customize REPL behavior and key bindings.
  • Consider pyrepl-hacks for portable shortcuts but beware private underscore modules may change.
INSIGHT

Polars' Lazy Execution Advantage

  • Polars uses lazy evaluation and chaining to optimize queries and memory use.
  • This lazy execution often yields big performance advantages over pandas for large data.
ANECDOTE

Fake Data Saved Hours

  • Christopher Trudeau kept a large spreadsheet of Simpsons characters with relationships for testing.
  • He wished he had used Faker to generate similar fake data in minutes instead of hours.
Get the Snipd Podcast app to discover more snips from this episode
Get the app