Python 3.15: 7 Game-Changing Features Developers Need to Know

Python 3.15 introduces seven major features including lazy imports for faster startup, built-in frozendict for immutable mappings, sentinel objects to replace None checks, an upgraded JIT compiler delivering 8-13% speedups, clearer error messages with cross-language method suggestions, and a rollback of the incremental garbage collector due to memory overhead.

21CTO
21CTO
21CTO
Python 3.15: 7 Game-Changing Features Developers Need to Know

Python 3.15 Release Overview

Python 3.15 release candidate (3.15.0rc2) is available, with the final version scheduled for October 1, 2026. Rather than a single headline feature, this release focuses on smoothing everyday development pain points: slow application startup, immutable configuration difficulties, profiling overhead, encoding inconsistencies, free-threaded Python, repetitive comprehension code, and frustrating debugging errors.

1. Explicit Lazy Imports Solve Slow Startup

Lazy imports allow modules to be loaded only when actually used, deferring the cost of heavy imports like pandas, torch, or other expensive packages until their code executes. Developers can opt in via new lazy import syntax, programmatically, or by forcing existing eager-import code to run lazily through an environment variable — no massive rewrites required. The article emphasizes there are no downsides: behavior matches expectations exactly.

import pandas
import torch
import expensive_package
print("Application started")

2. Built-in frozendict for Immutable Configuration

Python rarely adds new data types, but frozendict arrives after long discussion. It behaves like a regular dictionary but is immutable (cannot add, remove, or change elements) and hashable (can serve as a dictionary key). This solves the long-standing need for truly immutable mappings without third-party dependencies.

3. New Sentinel Objects via is Operator

A new is syntax creates unique sentinel objects that compare equal only to themselves via the is operator. This replaces the common but problematic pattern of using object() as a sentinel to distinguish "no argument provided" from "explicitly passed None." The new sentinels support proper type checking and have informative representations.

Before (ambiguous):

def update_user(name=None):
    if name is None:
        ...  # Cannot tell if caller omitted argument or passed None explicitly

After (clear):

MISSING = object()
def update_user(name=MISSING):
    if name is MISSING:
        print("No name was provided")
    elif name is None:
        print("Name was explicitly set to None")
    else:
        print(f"New name: {name}")

4. Upgraded JIT Compiler: 8–13% Geometric Mean Speedup

CPython's built-in JIT, introduced experimentally in 3.13, now delivers an 8% to 13% geometric mean performance improvement over standard CPython, depending on platform and workload. Key enhancements include a new tracing frontend (enabling speedups for more code patterns), register allocation for faster and more efficient memory use, higher-quality machine code generation, and optimizations such as eliminating reference counting for certain object classes. The article recommends enabling JIT for your workloads to measure real-world impact, while noting that future JIT development is now governed by explicit performance-threshold guidelines before it graduates from experimental to officially supported.

5. Clearer, Smarter Error Messages

Error messages continue their multi-version evolution toward precision and actionability:

Missing-attribute suggestions now include members of the object's members, not just the object itself.

Suggestions cover attribute deletion, not only access, and reference common method names from other languages (e.g., calling list.push() suggests list.append()). TypedDict gains closed (restrict runtime to declared keys) and extra_items (allow extra keys with typed values) parameters. TypeForm enables type annotations where a type expression's evaluated result is used as a value — useful for typing.cast variants, isinstance checks, and third-party type checkers.

6. Rollback of Incremental Garbage Collector

Python 3.14 introduced an incremental garbage collector to reduce GC pause times, but many users reported significantly increased process memory usage. Python 3.15 reverts to the generational GC used in 3.13 and earlier. The incremental GC may return in a future release after further improvements address the memory overhead.

7. Other Notable Changes

New math.integer module providing integer-specific functions (GCD, integer square root, etc.).

Stable ABI now supports free-threaded (no-GIL) Python extension builds, though extensions using the stable ABI require rewrites — not just recompilation.

Frame pointers enabled by default on supported CPython builds, making stack unwinding faster and more reliable for system-level profilers and debuggers.

UTF-8 is now the global default encoding (e.g., when reading text files), disableable via command-line flag or environment variable.

Reference:

https://peps.python.org/pep-0790/
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Garbage CollectionJIT compilererror messagesfrozendictPython 3.15free-threaded Pythonlazy importssentinel objects
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.