Python 3.15 adds explicit lazy imports, a built-in frozendict type and UTF-8 as the default text encoding.
Its experimental JIT showed platform-specific gains: 7–8% over the standard interpreter on x86-64 Linux and 11–12% over the tail-calling interpreter on AArch64 macOS.
The release also introduces Tachyon, which can profile a running Python process without a restart or code changes.
In tests on x86-64 Linux machines, the experimental execution mode was 7–8% faster than the standard one. On Macs with AArch64 processors, the improvement was 11–12% compared to a different execution mode. The percentages are for the specific tests and do not mean that every program will be faster.
The new option lazy allows programmers to delay loading imported code units until they are used. This allows programs that include many such units to start up more quickly.
Python now uses UTF-8 by default for reading and storing text. This makes its behavior more consistent across operating systems and can reduce issues when working with text files.
The release adds two new ways to organize prices. The frozendict is a dictionary that does not change after its creation and preserves the order in which its elements were added. The sentinel allows the creation of unique pointer values. For example, a programmer might use such a value to distinguish whether an argument was not given at all from the case where the value was given. None.
To help identify delays, Python adds a package that brings together performance measurement tools in a common environment. One of them is Tachyon, which monitors a program as it runs, with little overhead. It can be attached to a program that is already running, without restarting or changing the code. It measures the processor usage time, the actual execution time, and the time the program holds the thread limiter. It also creates graphs that help you see where time is being wasted.
Python 3.15 also expands support for versions that allow multiple threads to execute code simultaneously, without the usual shared limitation. It adds a stable compatibility mode for plugins targeting these versions, and brings related improvements to the way other programs interact with Python.
On supported Linux distributions, the base Python implementation now enables by default a feature that helps analysis tools monitor execution. Other changes include clearer error messages, more color on the command line, and new features for type checking. The official Windows releases on 64-bit computers now use an alternative execution method, while the macOS installers include support for versions that allow multiple threads to run concurrently by default.
For those who want to experience the new features through play, Barry Warsaw created the whatsnewt, a terminal adventure with 18 puzzles based on Python 3.15.
Top comments (1)
tr.ee/dev-to