Skip to content

Archive

Python 3.14

5 articles
Python 08 Sep 2026 9 min read

Use Zstandard Compression with Python compression.zstd

Python applications have long had standard-library support for gzip, bzip2, LZMA, and zlib. Python 3.14 adds another important option: Zstandard support through compression.zstd. Zstandard is useful when a system needs a practical balance of compression ratio and throughput. The new module means many applications can read and write .zst data without adding a third-party Python package. But choosing a compression API is not only about calling compress() and decompress(). Production code also needs to think about streaming, memory limits, frame boundaries, dictionaries, compatibility, and untrusted input.

Python 08 Sep 2026 8 min read

Use Native Max-Heaps with Python heapq

Python’s heapq module has historically been centered on min-heaps: the smallest element lives at index zero. Developers who needed a max-heap commonly negated numeric priorities before pushing them and negated them again after popping. Python 3.14 makes that workaround unnecessary for many programs. heapq now exposes a complete max-heap API: heapify_max(), heappush_max(), heappop_max(), heappushpop_max(), and heapreplace_max(). The new functions are simple, but using them well still requires understanding heap invariants, fixed-size selection, tie-breaking, and the important difference between push-pop and replace operations.

Python 08 Sep 2026 11 min read

Run CPU-Bound Python Work with InterpreterPoolExecutor

Python has traditionally offered two familiar high-level choices for parallel work: threads and processes. Python 3.14 adds a third option to concurrent.futures: InterpreterPoolExecutor. It runs workers in separate Python interpreters inside one process. Each worker has its own interpreter state and its own Global Interpreter Lock (GIL), so pure Python code can execute on multiple CPU cores at the same time. That makes the executor interesting for CPU-bound workloads, but it is not a drop-in way to make arbitrary threaded code parallel. Interpreter isolation changes the programming model. Mutable Python objects are not simply shared between workers, submitted work crosses a serialization boundary, imports and module globals are interpreter-local, and extension compatibility deserves deliberate testing.

Python 08 Sep 2026 12 min read

Process Template Strings Safely with Python T-Strings

Python’s f-strings are excellent when the desired result is immediately a string. That same immediacy becomes a limitation when an application needs to inspect interpolated values before deciding how they should be represented. Python 3.14 adds template string literals, usually called t-strings, for that boundary. A t-string looks much like an f-string, but it does not immediately collapse its literal text and interpolated values into one str. Instead, it produces a structured Template object from string.templatelib.

Python 08 Sep 2026 8 min read

Copy and Move Paths with pathlib in Python 3.14

Python 3.14 adds high-level copy and move operations directly to pathlib.Path. Path.copy(), Path.copy_into(), Path.move(), and Path.move_into() make many filesystem workflows easier to express without switching between pathlib, shutil, and os for basic operations. The convenience is useful, but filesystem mutations still need explicit policy. Overwrites, symbolic links, metadata, cross-filesystem moves, partial failure, and concurrent changes can all affect correctness. The four new operations Use copy() when the destination path itself is known: