Skip to content
Artwork for The Real Python Podcast
The Real Python Podcast · Friday · 47 min

Optimizing Python Performance & Building a Django Static Site

What goes into moving from profiling the performance of a Python program to optimizing it? What are common techniques you should consider for speeding up your code, and which ones should you avoid? Christopher Trudeau is back on the show this week with another batch of PyCoder’s Weekly articles and projects. We cover a recent Real Python practical guide about optimizing Python performance. The piece goes beyond the first step of finding the slow areas of code through profiling and into specific optimization techniques. We discuss choosing better algorithms and data structures, caching results, and using tools from the standard library. We also share other articles and projects from the Python community, including recent releases, a pair of Python Enhancement Proposals, using Django as a simple static site builder, how a Python type checker decides a variable is unused, pull request limits for the CPython repo, a Postman alternative built in Python using Textual, and a world clock for the terminal. Course Spotlight: Dictionaries and Arrays: Selecting the Ideal Data Structure In this course, you’ll learn about two of Python’s data structures: dictionaries and arrays. You’ll look at multiple types and classes for both of these and learn which implementations are best for your specific use cases. Live Course Spotlight: Want to go deeper on the data structures and Pythonic techniques behind faster code? Real Python’s Intermediate Python Deep Dive live course takes you from the object model through generators, decorators, and specialized data structures with expert guidance. Join the waitlist to hear about the next dates. Topics: 00:00:00 – Introduction 00:02:04 – Python 3.15.2, 3.14.10, 3.13.18, 3.12.16 and 3.11.18 Released 00:02:34 – Python 3.16.0 alpha 2 is now available 00:03:08 – Django Security Releases Issued: 6.1.3, 6.0.10, and 5.2.19 00:03:25 – Advice on managing security releases and updates 00:09:06 – PEP 850: Wheel Variants: Providers 00:09:49 – PEP 836: JIT Go Brrr: Python’s Experimental JIT to Be Removed 00:11:17 – Announcing New Security Developer at the PSF 00:11:55 – In Memoriam: Tim Peters 1952–2026 00:12:57 – Python Performance Optimization: A Practical Guide 00:25:54 – Video Course Spotlight 00:27:24 – Django as a Simple Static Site Builder 00:33:08 – How a Python Type Checker Decides a Variable Is Unused 00:38:47 – Pull Request Limits for CPython Repo 00:41:44 – Ghostman: Postman Alternative Built in Python With Textual 00:44:04 – terrahour: World Clock With a Day/Night Map for the Terminal 00:46:18 – Thanks and goodbye News: Python 3.15.2, 3.14.10, 3.13.18, 3.12.16 and 3.11.18 Released Python 3.16.0 alpha 2 is now available Django Security Releases Issued: 6.1.3, 6.0.10, and 5.2.19 PEP 850: Wheel Variants: Providers (Draft) PEP 836: JIT Go Brrr: The Path to a Supported JIT Compiler for CPython (Withdrawn) Python’s Experimental JIT to Be Removed – PEP 836 has been withdrawn and the experimental JIT is to be removed from CPython’s main branch. This article talks about the JIT’s journey and what still may be in store. Announcing New Security Developer at the PSF – The Python Software Foundation welcomes Brett Smith as an additional security developer. In Memoriam: Tim Peters 1952–2026 - Core Development - Discussions on Python.org Show Links: Python Performance Optimization: A Practical Guide – Learn practical Python performance optimization techniques, from confirming a bottleneck with timeit to picking the fix that makes your program faster. Django as a Simple Static Site Builder – Combining three libraries: nanodjango, django-nanopages, and django-distill, you can create a static site generator in just a few lines of code. Why learn another tool when you already know Django? How a Python Type Checker Decides a Variable Is Unused – A variable is unused only if no read resolves to its binding and in Python that read can sit inside a nested function or comprehension. This post walks through how ty, Astral’s Python type checker, finds local bindings nobody reads. Pull Request Limits for CPython Repo – PyPI has set a limit for the maximum number of PRs you can open at python/cpython to 3, including drafts. Project: Ghostman: Postman Alternative Built in Python With Textual terrahour: World Clock With a Day/Night Map for the Terminal Additional Links: What Exactly Is the Zen of Python? – Real Python Profiling in Python: How to Find Performance Bottlenecks – Real Python Python’s Sampling Profiler: Low-Overhead Profiling With profiling.sampling – Real Python Python Timer Functions: Three Ways to Monitor Your Code – Real Python Common Python Data Structures (Guide) – Real Python Speed Up Your Python Program With Concurrency – Real Python Level up your Python skills with our expert-led courses: Dictionaries and Arrays: Selecting the Ideal Data Structure Records and Sets: Selecting the Ideal Data Structure Build an AI Agent From Scratch in Python Support the podcast & join our community of Pythonistas

0:00-47:18

transcript

No transcript — this publisher did not publish one.

show notes

What goes into moving from profiling the performance of a Python program to optimizing it? What are common techniques you should consider for speeding up your code, and which ones should you avoid? Christopher Trudeau is back on the show this week with another batch of PyCoder’s Weekly articles and projects.

We cover a recent Real Python practical guide about optimizing Python performance. The piece goes beyond the first step of finding the slow areas of code through profiling and into specific optimization techniques. We discuss choosing better algorithms and data structures, caching results, and using tools from the standard library.

We also share other articles and projects from the Python community, including recent releases, a pair of Python Enhancement Proposals, using Django as a simple static site builder, how a Python type checker decides a variable is unused, pull request limits for the CPython repo, a Postman alternative built in Python using Textual, and a world clock for the terminal.

Course Spotlight: Dictionaries and Arrays: Selecting the Ideal Data Structure

In this course, you’ll learn about two of Python’s data structures: dictionaries and arrays. You’ll look at multiple types and classes for both of these and learn which implementations are best for your specific use cases.

Live Course Spotlight: Want to go deeper on the data structures and Pythonic techniques behind faster code? Real Python’s Intermediate Python Deep Dive live course takes you from the object model through generators, decorators, and specialized data structures with expert guidance. Join the waitlist to hear about the next dates.

Topics:

  • 00:00:00 – Introduction
  • 00:02:04 – Python 3.15.2, 3.14.10, 3.13.18, 3.12.16 and 3.11.18 Released
  • 00:02:34 – Python 3.16.0 alpha 2 is now available
  • 00:03:08 – Django Security Releases Issued: 6.1.3, 6.0.10, and 5.2.19
  • 00:03:25 – Advice on managing security releases and updates
  • 00:09:06 – PEP 850: Wheel Variants: Providers
  • 00:09:49 – PEP 836: JIT Go Brrr: Python’s Experimental JIT to Be Removed
  • 00:11:17 – Announcing New Security Developer at the PSF
  • 00:11:55 – In Memoriam: Tim Peters 1952–2026
  • 00:12:57 – Python Performance Optimization: A Practical Guide
  • 00:25:54 – Video Course Spotlight
  • 00:27:24 – Django as a Simple Static Site Builder
  • 00:33:08 – How a Python Type Checker Decides a Variable Is Unused
  • 00:38:47 – Pull Request Limits for CPython Repo
  • 00:41:44 – Ghostman: Postman Alternative Built in Python With Textual
  • 00:44:04 – terrahour: World Clock With a Day/Night Map for the Terminal
  • 00:46:18 – Thanks and goodbye

News:

Show Links:

Project:

Additional Links:

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

Support the podcast & join our community of Pythonistas

links28