
Python, the popular general purpose programming language, released new major 3.15 version yesterday.
The new version is the result of 17 months of development, that features many new typing features, interpreter, standard, and C API library improvements.

Python 3.15 introduced new typing features. They include a new special form TypeForm for annotating values that are themselves type expressions, @typing.disjoint_base decorator that can be used to mark a nominal class as a disjoint base.
There are as well closed=True to disallow extra keys, and extra_items allows extra keys of a specific type in TypedDict.

The standard library has been significantly improved with a new profiling module to organize Python’s built-in profiling tools. It includes profiling.tracing deterministic function-call tracing and profiling.sampling a new statistical sampling profiler.
It as well added a new high frequency statistical sampling profiler Tachyon available through the profiling.sampling module. It enables low-overhead performance analysis of running Python processes without requiring code modification or process restart.
For C API, it introduced new PyBytesWriter API to create a Python bytes object, new functions to help prevent threads from hanging or crashing when they try to access Python while its interpreter is shutting down.
And, it introduced a stable ABI for Python’s free-threaded builds to let C extension modules work across multiple Python versions without needing a separate build for every version, including builds that support running Python threads without the Global Interpreter Lock (GIL).

Python 3.15 now uses UTF-8 as the default encoding, which handle text more consistently across different languages and operating systems.
It supports lazy import for faster startup times. When you import a model as lazy (e.g., lazy impor json, lazy from pathlib import Path), Python defers the actual module loading until the imported name is first used.
And, list, set, and dictionary comprehensions, as well as generator expressions, now support unpacking with * and **.
Other changes in Python 3.15 include:
- Add new
sentineltype to thebuiltinsmodule. - Add frozendict built-in type.
- Introduce
.startfiles to automatically run specific functions whenever the Python interperter starts. - Update the experimental JIT compiler with 7%~8% performance improvement on x86-64 Linux, and 11%~12% speedup on AArch64 macOS.
How to Install Python 3.15 in Ubuntu
The official release note, the installer packages for Windows, macOS, as well as the source tarball are available in Python website via the link below:
For Ubuntu & Linux Mint, the popular Deadsnake PPA has been updated with the new version package for Ubuntu 26.04, Ubuntu 24.04, and Ubuntu 22.04. And, it’s easy to build from source.
source https://ubuntuhandbook.org/index.php/2026/10/python-3-15-utf-8-lazy-import/
Tidak ada komentar:
Posting Komentar