Python 3.15 Alpha 7 Lands With Built-in frozendict, Lazy Imports, and a Statistical Profiler as the Language's Biggest Feature Release Takes Shape
Python 3.15.0a7 introduces frozendict as a built-in type, explicit lazy imports for faster startup, a statistical sampling profiler, and JIT compiler improvements delivering up to 9% speedups.
Overview
The Python core development team released Python 3.15.0 alpha 7 on March 10, the seventh of eight planned alpha releases before the beta freeze on May 5. The release consolidates a sweeping set of language additions that collectively represent one of Python’s most feature-rich development cycles in years, headlined by a built-in immutable dictionary type, a new keyword for deferred module loading, and a production-grade statistical profiler.
What We Know
frozendict Arrives as a Built-in Type
The marquee addition is frozendict, a new immutable mapping type added to Python’s builtins under PEP 814, authored by Victor Stinner and Donghee Na. The Python Steering Council accepted the proposal in February, reaching Final status on February 11.
Just as frozenset provides an immutable counterpart to set, frozendict offers the same for dict. Instances cannot be modified after creation — attempting item assignment raises a TypeError. When all keys and values are themselves hashable, a frozendict is also hashable, which means developers can now use dictionary-like structures directly as dictionary keys or set members without converting them to tuples first.
Notably, frozendict does not inherit from dict. It inherits directly from object and implements the collections.abc.Mapping protocol. According to the official documentation, this design choice keeps immutability guarantees clean and prevents accidental mutation through inherited methods. The type supports the union operator (|) for merging and preserves insertion order, though comparison is order-independent.
Seven standard library modules have been updated to accept frozendict: copy, decimal, json, marshal, pickle, pprint, and xml.etree.ElementTree.
Explicit Lazy Imports Cut Startup Time
Python 3.15 introduces the lazy keyword for deferred module loading under PEP 810, proposed by Pablo Galindo Salgado. As The Register reported when the PEP was approved in November 2025, the feature addresses a longstanding frustration: large applications with deep dependency trees suffer from slow startup because Python must locate, read, compile, and execute all imported module code at load time, even when most of it is never used.
With lazy import json or lazy from pathlib import Path, Python defers the actual module loading until the imported name is first used. The feature is restricted to module scope — using lazy inside a function, class body, or try/except block raises a SyntaxError. Runtime control is available through sys.set_lazy_imports() and a CLI option (-X lazy_imports).
The PEP succeeded where its predecessor, PEP 690, failed. That earlier proposal was rejected partly because it made lazy imports the default, raising backward compatibility concerns. PEP 810 makes the behavior strictly opt-in.
A Statistical Profiler Joins the Standard Library
PEP 799 introduces a high-frequency, low-overhead statistical sampling profiler and a dedicated profiling package to the standard library, according to the What’s New documentation. The profiler supports sampling rates up to 1,000,000 Hz and can attach to running processes, profile wall time, CPU time, or GIL holding time, and output results in multiple formats including flamegraphs, heatmaps, and a live TUI.
The tool is thread-aware and async-aware, and requires zero code modification — a meaningful step beyond Python’s existing cProfile and profile modules.
JIT Compiler Gains Ground
The experimental JIT compiler, first introduced in Python 3.13, has received significant upgrades in this cycle. According to the official release notes, the JIT now delivers a 5-6% geometric mean improvement on x86-64 Linux and an 8-9% speedup on AArch64 macOS over the tail-calling interpreter. Improvements include an upgrade to LLVM 21, basic register allocation, enhanced constant propagation, and reduced reference count operations.
Additional Changes
Other notable features in the alpha include PEP 798 (unpacking in comprehensions with * and ** operators), PEP 686 (UTF-8 as the default encoding), PEP 747 (TypeForm annotations), and performance improvements to base64 encoding (2x faster) and decoding (3x faster). The mimalloc allocator is now the default for raw memory allocations, and builds using Visual Studio 2026 report 15-20% speedups on Windows x86-64 with the tail-calling interpreter.
What We Don’t Know
The frozendict implementation is still being finalized ahead of the May 5 beta freeze, and it remains unclear whether deferred features such as special literal syntax or O(1) conversion from mutable dicts will make it into a future release. The JIT compiler remains experimental and disabled by default, and the core team has not indicated when it might graduate to stable status. The final alpha (3.15.0a8) is scheduled for April 7, with the production release targeted for October 2026.