Member-only story
Finally, Python 3.15 Is Here. A Bigger Update Than I Expected
Lazy imports, frozen dictionaries, and a few smaller improvements that make everyday Python less annoying.
I like small Python improvements. Being able to flatten a list like this is enough to get my attention
batches = [[1, 2], [3, 4]]
items = [*batch for batch in batches]Python 3.15 adds unpacking inside comprehensions. The longer version worked perfectly well. I just like having this option.
But lazy imports and frozen dictionaries are the changes I’m more interested in.
Lazy imports, with a catch
I like opening a file and seeing its dependencies at the top. Moving expensive imports into functions helps with startup time, but it scatters those declarations around.
Now we can write
lazy import pandas as pdThe module loads when the imported name is first used. If a particular command never needs pandas, it can avoid that loading cost.
There’s a trade off. Import errors also arrive later. So do any side effects from executing…









