The Real Python Podcast

Should You Understand Your Entire Python Codebase?

Should you understand the entirety of your codebase? How familiar are you with Python’s built-in functions? Christopher Trudeau is back on the show this week with another batch of PyCoder’s Weekly articles and projects.

We discuss a recent article by Sean Goedecke titled “In Defense of Not Understanding Your Codebase.” We dig into the differences in the scale of software projects and the factors that can obscure understanding of an entire codebase. We cover how opinions and practices people often argue for are based on the development practices from decades ago.

Christopher shares his recent video course that explores Python’s built-in functions. The course is divided into sections to help you find the right built-in for tasks involving math, data types, iterables, and I/O. We discuss which of these functions are frequently used in our code.

We also share other articles and projects from the Python community, including recent releases, querying with f-expressions in Django, replacing if-else chains, a Rust-based replacement for Python’s json module, and a couple of Python cheat sheet resources.

This episode is sponsored by HydraDB.

Course Spotlight: Exploring Python’s Built-in Functions

Learn Python’s built-in functions for math, data types, iterables, and I/O, and when to use each to write more Pythonic code.

Topics:

  • 00:00:00 – Introduction
  • 00:02:29 – Christopher’s Python News Song
  • 00:03:18 – Python 3.15.0 Beta 4 Released
  • 00:03:39 – PEP 838: Adding python-version to pyvenv.cfg
  • 00:04:59 – PEP 840: Name Resolution in Class Namespaces
  • 00:06:42 – Stop Using if-else Chains
  • 00:13:46 – Sponsor: HydraDB
  • 00:14:44 – Nifty Django Feature: F Expressions
  • 00:20:23 – In Defense of Not Understanding Your Codebase
  • 00:34:13 – Exploring Python’s Built-in Functions
  • 00:45:26 – Video Course Spotlight
  • 00:46:57 – Python strftime/strptime Directive Cheat Sheet
  • 00:50:22 – Itertools Cheatsheet
  • 00:52:59 – Introducing django-orjson
  • 00:55:33 – Thanks and goodbye

News:

  • Python 3.15.0 Beta 4 Released
  • PEP 838: Adding python-version to pyvenv.cfg (Added)
  • PEP 840: Name Resolution in Class Namespaces (Added)

Show Links:

  • Stop Using if-else Chains – Learn a cleaner, more extensible way to dispatch logic in Python using dictionaries and function pointers instead of long if-else chains.
  • Nifty Django Feature: F Expressions – Django’s F-Expression provides a way of querying fields from the ORM. They’re particularly handy to traverse relationships in more complex queries.
  • F() Expressions - Django Documentation
  • In Defense of Not Understanding Your Codebase – In this opinion piece, Sean argues that there is a difference in the thought process between maintaining smaller software projects vs larger ones, and that the former is over represented in engineering discussion in the internet.
  • Exploring Python’s Built-in Functions – Learn Python’s built-in functions for math, data types, iterables, and I/O, and when to use each to write more Pythonic code.

Projects:

  • Python strftime/strptime Directive Cheat Sheet
  • Itertools Cheatsheet – Cheatsheet with visual diagrams that explain how the iterables from itertools work.
  • Introducing django-orjson – orjson is a Rust-based replacement for Python’s json module. So what would Adam Johnson do with it? Make it easier to use in Django of course.
  • orjson: Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy
  • django-orjson documentation

Additional Links:

  • Primer on Python Decorators - Registering Plugins
  • Python Built-in Functions: A Complete Guide
  • Python Cheat Sheet – Real Python
  • What’s in which Python - Ned Batchelder

Level up your Python skills with our expert-led courses:

  • Using Python's datetime Module
  • Python Basics: Conditional Logic and Control Flow
  • Exploring Python's Built-in Functions

Support the podcast & join our community of Pythonistas