Python 3.15 was released on 9 October 2026. It is a release full of practical improvements rather than one headline feature: scripts start faster, text files behave the same on every computer, and finding out why code is slow no longer needs extra tools. Here are the changes that matter most if you work with data, with examples you can try today.
Lazy imports: faster start-up for scripts and CLIs
PEP 810 adds a new lazy keyword. A lazy import binds the name straight away, but the module is only actually loaded the first time you use it.
lazy import json
lazy from pathlib import Path
print("Starting up...") # json and pathlib are not loaded yet
data = json.loads('{"key": "value"}') # json is imported here, on first use
p = Path(".") # and pathlib hereWhy it matters for data work: data scripts often import heavy libraries such as pandas, matplotlib or a cloud SDK, even when a particular run only needs one of them. With lazy imports, a command that only prints --help or processes a small file no longer pays to load everything. The total cost does not disappear for a program that uses every import; it simply moves to the first use.
UTF-8 is now the default encoding
With PEP 686, open() uses UTF-8 when you do not pass an encoding, whatever the computer's language settings. Before 3.15, the same script could read a CSV correctly on a Mac and turn accented names into garbage on a Windows machine configured for another code page.
# Python 3.15: UTF-8 on every operating system
with open("customers.csv") as f:
header = f.readline()Why it matters: fewer "it works on my machine" bugs with names like Zoë, Müller or Ecclesie Agazzi. If you genuinely need the old behaviour, run with PYTHONUTF8=0. The best habit is still to pass encoding="utf-8" explicitly in code that must also run on older versions.
frozendict: a built-in immutable dictionary
PEP 814 adds frozendict, a dictionary that cannot be changed and can therefore be hashed, used as a dictionary key or stored in a set.
defaults = frozendict({"currency": "GBP", "decimals": 2})
custom = defaults | {"currency": "EUR"} # creates a new frozendict
defaults["currency"] = "USD"
# TypeError: 'frozendict' object does not support item assignmentIt is ideal for configuration and lookup tables that should never change by accident while a pipeline runs. Note that frozendict is not a subclass of dict, so code that checks isinstance(x, dict) should check for collections.abc.Mapping instead.
Unpacking inside comprehensions
PEP 798 lets you use * and ** inside comprehensions, which makes flattening lists and merging dictionaries much easier to read.
batches = [[1, 2], [3, 4], [5]]
rows = [*batch for batch in batches] # [1, 2, 3, 4, 5]
configs = [{"region": "UK"}, {"currency": "GBP"}, {"region": "IT"}]
merged = {**c for c in configs} # {'region': 'IT', 'currency': 'GBP'}A built-in sampling profiler
PEP 799 adds a new profiling package. profiling.tracing is the familiar deterministic profiler (cProfile still works as an alias), and profiling.sampling is a new low-overhead sampling profiler that can attach to a process that is already running, without changing its code.
# Profile a script from the start
python -m profiling.sampling run my_pipeline.py
# Or attach to a long-running job by process ID
python -m profiling.sampling attach 12345Why it matters: when a nightly job suddenly takes three hours instead of thirty minutes, you can now attach to it and see where the time goes, with flame graphs and a live view, using only the standard library.
A faster (still experimental) JIT
The experimental JIT compiler received major upgrades. The core team reports average speed-ups of about 7 to 8% over the standard interpreter on Linux x86-64, and 11 to 12% on Apple silicon Macs. It is still off by default; you can try it with PYTHON_JIT=1 on builds that include it. On Windows, the python.org installers also gained a faster interpreter design.
Ranges reported by the CPython core team for Python 3.15; the bars show the top of each range. The JIT is still experimental and off by default.
The free-threaded (no-GIL) build keeps the status it gained in 3.14: officially supported, but optional and installed separately. A new stable ABI for free-threaded builds (PEP 803) makes it easier for libraries to publish wheels for it, which is what most data libraries are waiting for.
Smaller changes worth knowing
- sentinel (PEP 661)
- A new built-in for unique "no value given" markers, such as
MISSING = sentinel("MISSING"), so a default ofNoneno longer has to mean two things. - Friendlier errors
- Calling
[1, 2, 3].push(4)now suggestsappend, and similar hints cover habits from JavaScript and Java. - TypedDict extra keys (PEP 728)
- Helps when typing JSON from APIs.
- re.prefixmatch()
- A clearer name for
re.match(), which only matches at the start of a string. - profile deprecated
- The old
profilemodule will be removed in Python 3.17.
Should you upgrade?
New projects
Try it now- Personal scripts and new projects
- With uv:
uv python install 3.15
Production pipelines
Wait a few weeks- Until pandas, NumPy, database drivers and cloud SDKs publish 3.15 wheels
- Test in a branch, then pin the version
Check first
Two gotchas- Code that relied on a non-UTF-8 default encoding
isinstance(x, dict)checks that might now receive afrozendict
Check your understanding
1/3When is a module loaded with lazy import json?
The name is bound straight away; the cost moves to first use.
2/3What is the default encoding for open() in Python 3.15?
PEP 686 made UTF-8 the default; PYTHONUTF8=0 restores the old behaviour.
3/3Why might isinstance(x, dict) fail on a frozendict?
Check for collections.abc.Mapping instead.
You got 0 out of 3.
Still on an older version? What's new in Python 3.14 covers the previous release, including official free-threading and template strings.
Library news for the same upgrade cycle: scikit-learn 1.9, pandas 3.0, Polars 2.0 and Apache Spark 4.2, whose PySpark now uses Arrow by default.
Sources: the official "What's New in Python 3.15" documentation on python.org and the Python 3.15 release coverage. Always check the official page and your libraries' release notes before upgrading production code.
