Python 3.15: features that didn't make the headlines

rbanffy 357 points 171 comments May 21, 2026
blog.changs.co.uk · View on Hacker News

Discussion Highlights (16 comments)

brianwawok

I was so into Python for 10 years, was enjoyable to work in. But have deleted 100k+ lines this year already moving them to faster languages in a post AI codebot world. Mostly moving to go these days.

kokada

From this example: lazy from typing import Iterator def stream_events(...) -> Iterator[str]: while True: yield blocking_get_event(...) events = stream_events(...) for event in events: consume(event) Do we finally have "lazy imports" in Python? I think I missed this change. Is this also something from Python 3.15 or earlier?

JohnKemeny

> I've left this one to the bonus section because I've never used set operations on Counters and I'm finding it extremely hard to think of a use case for xor specifically. But I do appreciate the devs adding it for completeness. Check out symmetric difference https://en.wikipedia.org/wiki/Symmetric_difference

sunshine-o

I am not a python dev but have the utmost respect for the ecosystem. But damn, with all the supply chain attacks now in the news, could they just make a simple way (for non python insiders) to install python apps without fearing to be infected by a vermin with full access to my $HOME ...

armanj

funny how we may have to wait even longer for llms to pick up this update in their pre-training

kwon-young

It's nice that python 3.15 added Iterator synchronization primitives: https://docs.python.org/3.15/library/threading.html#iterator... . These will nicely complement my threaded-generator package which is doing just this but using a thread/process+generator+queue: https://pypi.org/project/threaded-generator/

veqq

There's a good interview about Python internals and management, particularly in relation to free-threading: https://alexalejandre.com/programming/interview-with-ngoldba...

syedMohib45

Thread safe ittertors? really are we still on these topics lazy from typing import Iterator def stream_events(...) -> Iterator[str]: while True: yield blocking_get_event(...) events = stream_events(...) for event in events: consume(event)

drchaim

Oh, my beloved Python, for nearly 15 years I wrote you. I miss you, but I no longer do — it's not your fault, life has changed.

jwineinger

One of the Counter examples is incorrect, tested on both 3.13 and 3.15.0a >>> from collections import Counter >>> c = Counter(a=3, b=1) >>> d = Counter(a=1, b=2) >>> c-d Counter({'a': 2})

xg15

> Iterators, async functions and async iterators don't work well here because they have different semantics to standard functions. When you call them they return immediately with a generator object, coroutine function and async generator object respectively. So the decorator completes immediately as opposed to the entire lifecycle what it's wrapping. > This is an unfortunate problem I've encountered many times, and it's often a problem for normal decorators too. But this has changed in 3.15, now the ContextDecorator will check the type of the function it's wrapping and ensure that the decorator covers the entire lifespan. I very much like the idea of that change - but it also seems kind of dangerous, to do this with no "opt-in mechanism", as that quite subtly changes the behavior of existing usage sites. This is a bit of a "spacebar heating" situation, because someone would have to intentionally use a decorator in the old, broken way, but if someone actually did that, things may unexpectedly break.

aniou

I come to Python around version 1.5, painfully tired by debugging CGI scripts, created by wannabe perl-golfers. Unfortunately, I feel like Python is losing more and more of the zen that once tempted me... Lazy loading looks like a last nail in the coffin, where my love to Python was buried, although it was a long, tiresome process.

BiteCode_dev

Note that 3.15 is not released yet. It will come out in 4 months

vorsken

The `except*` improvements are underrated. Been using ExceptionGroup in a CLI tool that wraps Semgrep — catching multiple subprocess errors cleanly in one block made the retry logic much simpler.

axpy906

When Wes McKinney wrote about the transition away from python I knew it was real. https://wesmckinney.com/blog/agent-ergonomics/ I still have a special place in my heart for the language and think it’s still got a niche.

groundzeros2015

Why does every language need every feature? Python has completely lost its charm.

Semantic search powered by Rivestack pgvector
8,303 stories · 78,303 chunks indexed