ππ [3.15] 4 upgrades to the std library
October 28, 2026
ππ [3.15] 4 upgrades to the std library
day 12 of 15 days of Python 3.15
Hey there, π
How is your Python π going?
In this email weβll talk about 4 improvements made to the standard library in 3.15. π
See the future schedule here and links to the previous days: https://mathspp.com/python-315
New object_hook in json.load
The new parameter can be set to a function.
This function runs whenever JSON loads a dictionary.
Use it with frozendict and array_hook=tuple to load JSON data as immutable:
import json
def load_immutable_json(filepath):
with open(filepath, "r") as f:
data = json.load(
f,
object_hook=frozendict,
array_hook=tuple,
)
return dataNew module math.integer
This new module has 6 functions that operate on integers and return integers:
comb(n, k)perm(n, k=None)gcd(*integers)lcm(*integers)isqrt(n)factorial(n)
New re.prefixmatch function
This actually isnβt new functionality.
prefixmatch is exactly the same as match.
The problem is that match has a confusing name.
I always use it thinking itβs the same as re.search.
So, prefixmatch makes the behaviour more clear.
New code should use prefixmatch but match will be kept for backwards-compatibility.
New TaskGroup.cancel method
You can now cancel task groups (and all their tasks) with the method cancel.
Much more convenient than keeping track of all tasks manually and then cancelling each in turn.
Other exciting additions to the std library
Of course the std library got other exciting additions, but we covered many of them already:
new built-in
frozendictnew built-in
sentinelnew module
profilingand the new profiler Tachyon (profiling.sampling)improvements to
typing(betterTypedDict, newTypeForm, new@disjoint_base, ...)
Further reading
You can learn more about each new feature by reading the full article here: https://mathspp.com/blog/4-upgrades-to-the-python-standard-library-in-315
Tomorrow youβll learn about the improvements made to iterators so they work with concurrency.
See the future schedule here and links to the previous days: https://mathspp.com/python-315
You received this email (at [subscriber]) because you got my free Python book βPydonβtsβ or one of my other books/cheatsheets (or because you signed up directly!).
Rodrigo ππ
Β© 2026 mathspp insider ππ
228 Park Ave S, #29976, New York, New York 10003, United States