What’s New in Python 3.15: Lazy Imports, frozendict, sentinel, and the Tachyon Profiler

Python 3.15 shipped on October 9, 2026. Here's a practical tour of lazy imports, the new frozendict and sentinel built-ins, UTF-8 by default, and the new sampling profiler, with code you can run today.

Python 3.15 Is Out: What Actually Matters

Python 3.15 was released on October 9, 2026, after a surprise third release candidate to fix last-minute lazy-import blockers. It’s the first release on the annual cycle that is mostly about startup time, immutability, and profiling rather than syntax churn. This guide covers the changes you’re most likely to use in everyday code.

1. Explicit Lazy Imports

Large applications often pay a heavy startup cost importing modules they may never use on a given code path. Python 3.15 adds an explicit lazy keyword so a module is only loaded the first time it is actually used.

lazy import json
lazy from pathlib import Path

def load_config(path):
    # json is only imported when this function first touches it
    with open(path, encoding="utf-8") as f:
        return json.load(f)

This is especially useful for CLI tools, where a command like --help shouldn’t need to import your entire dependency tree. Because the behavior is explicit, you opt in per import and don’t change semantics for code that relies on import side effects.

2. frozendict: An Immutable Mapping in the Built-ins

frozendict is a hashable, immutable dictionary. That makes it usable as a dictionary key, a set member, or a safe default value that nobody can mutate by accident.

settings = frozendict({"region": "eu-west-1", "retries": 3})

# settings["retries"] = 5   # TypeError: frozendict is immutable

cache = {}
cache[settings] = "expensive result"   # works, because it's hashable

# Create a modified copy instead of mutating
updated = frozendict({**settings, "retries": 5})

Remember that a frozendict is only hashable if all of its values are hashable too.

3. sentinel: A Clean “No Value Given” Marker

For years, developers wrote _MISSING = object() to distinguish “argument not passed” from None. The new sentinel type gives that pattern a proper, self-describing form.

MISSING = sentinel("MISSING")

def get_option(name, default=MISSING):
    value = OPTIONS.get(name, MISSING)
    if value is MISSING:
        if default is MISSING:
            raise KeyError(name)
        return default
    return value

Sentinels have a readable repr, which makes debugging and generated documentation far better than an anonymous object().

4. UTF-8 as the Default Encoding

Text files now default to UTF-8 on every platform. If you’ve ever hit a UnicodeDecodeError on Windows because open() picked a legacy locale encoding, this removes that whole class of bug. You should still pass encoding="utf-8" explicitly in libraries that need to run on older Python versions.

5. A Faster JIT and a New Sampling Profiler

The experimental JIT compiler received further speedups in this release, and a new sampling profiler called Tachyon can attach to a running process with very low overhead. That is a big deal for diagnosing slow production services, because you no longer need to restart under a tracing profiler to see where time is going. Check the official “What’s New in Python 3.15” page for the exact command-line options for your platform.

How to Try It Safely

# Install alongside your existing Python
py install 3.15            # Windows
uvx --python 3.15 python --version

# Run your test suite against 3.15 in CI
python3.15 -m pytest -W error::DeprecationWarning

Running your tests with deprecation warnings turned into errors is the fastest way to find removals that will affect you. If you maintain a library, publish 3.15 wheels so downstream users can test too.

Migration Checklist

  • Add Python 3.15 to your CI matrix and fix any deprecation failures.
  • Replace object() sentinels with sentinel(...) in new code.
  • Use lazy import in CLI entry points to cut startup time.
  • Audit any code that relied on the platform default text encoding.

Conclusion

Python 3.15 is a quality-of-life release: faster startup with lazy imports, safer configuration with frozendict, clearer APIs with sentinel, and better visibility with a production-friendly profiler. Test early, adopt the new built-ins in new code, and upgrade once your dependencies publish compatible wheels.