hn.today

What's New in Python 3.15

docs.python.org10 points1 comments
Screenshot of What's New in Python 3.15

Python 3.15 is a feature-and-performance focused release that changes language, interpreter, C API, build options, and the standard library. Major language/implementation additions include explicit lazy imports (PEP 810) to cut startup time, a built-in immutable mapping frozendict (PEP 814), a sentinel builtin for unique marker objects (PEP 661), UTF‑8 as the default encoding (PEP 686), unpacking in comprehensions (PEP 798), and a stable ABI for free‑threaded builds plus frame pointers enabled by default for better observability. The standard library gains a dedicated profiling package (PEP 799) with Tachyon, an upgraded experimental JIT, more colorful CLI output, many module improvements, and a set of deprecations/removals and portability tweaks.

Key specifics: lazy imports use a new lazy soft keyword to create lightweight proxy names that load modules only on first use; global control is available via -X lazy_imports, PYTHON_LAZY_IMPORTS, and runtime APIs (sys.set_lazy_imports, sys.get_lazy_imports, sys.set_lazy_imports_filter), and types.LazyImportType lets code detect proxies. Lazy imports are restricted to module scope and exclude star/future imports; a lazy_modules fallback supports gradual adoption. Frozendict is an order‑preserving, hashable, non‑dict mapping accepted by many stdlib APIs and usable with eval/exec; sentinel gives concise, picklable unique sentinels. C API and build changes target robustness for free‑threaded interpreters and improved tooling integration.

Read on docs.python.org1 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.