Python 3.15 is set to introduce a mix of language, runtime, and standard-library changes. Highlights include lazy imports, built-in frozendict and sentinel types, UTF-8 becoming the default encoding, unpacking with * and ** inside comprehensions, a stable ABI for free-threaded builds, improved dictionary performance, a new profiling package featuring Tachyon, and more colorful command-line output. Which changes stand out as the most useful or exciting, and are there any compatibility concerns to watch for?
5 Answers
UTF-8 becoming the default encoding should make behavior more consistent across systems, but applications that depended on a machine's locale may need testing. Code that reads or writes files with legacy encodings should specify the encoding explicitly instead of relying on the default.
Lazy imports could make a noticeable difference for large command-line tools and complicated test setups. Programs would no longer need to load every heavy dependency just to display help or report an argument error. Function-local imports have been the usual workaround, but a language-level solution should be much cleaner.
Frozendict fills a long-standing gap for immutable mappings. Tuples work well when a fixed sequence is needed, but dictionaries did not have an equally natural immutable counterpart; MappingProxyType was useful but awkward. A built-in frozendict should be handy for constants, defaults, caching, and type-related code. The release also appears to include useful dictionary-operation speedups for workloads that frequently insert and delete keys.
The zero-copy bytearray.take_bytes() behavior works because bytearray can use an indirection to its underlying bytes storage. Resizable, reference-counted objects need that extra layer because resizing can move the data. When the entire buffer is taken, Python can transfer the existing bytes object and replace the bytearray's storage with an empty singleton rather than copying everything.
Unpacking in comprehensions is a great quality-of-life improvement. Something like [*items for items in groups] can now flatten a collection of lists directly, instead of requiring a nested comprehension or another workaround. The same general idea applies to combining dictionaries with **.

It would be especially useful when different test environments support different optional dependencies. Imports could be delayed until the relevant functionality is actually used.