about the what and when of new python features
- introduction of extended iterable unpacking which enables e.g.
a, *b, c = [1, 2, 3, 4, 5]
sob
becomes[2, 3, 4]
(PEP 3132)
- introduction of yield from (PEP380)
- introduction of pathlib (PEP 428)
- introduction of type annotations (PEP 484)
- ATTENTION: you cannot use type annotations for variables yet; instead use type comments
- introduction of additional unpacking generalizations (PEP 448)
- introduction of type annotations for variables (PEP 526)
- f-strings (PEP 498)
- introduction of underscores in numeric literals, e.g.
1_000
(PEP 515)
- postponed evaluation of annotations via
from __future__ import annotations
(PEP 563) - sort order of dicts is now guaranteed
- introduction of
breakpoint()
, additionally toimport pdb;pdb.set_trace()
(PEP 553) - introduction of data classes (PEP 557)
- introduction of the walrus operator (PEP 572)
- builtin generic types, that means you can use
list
anddict
for type annotations, instead of importing e.g.from typing import List
(PEP 585)
- allow writing union types as X | Y (PEP 604)
- introduction of structural pattern matching, which is a kind of switch/case on steroids (PEP 622)
- exception groups and except*, a new standard to raise and handle multiple unrelated exceptions simultaneously (PEP654)
- support for parsing TOML in the standard library via tomllib (PEP 680)
Do you need all the nitty gritty details?
Do you think this overview is useful? Share it!
Do you think you can contribute? Do not hesitate!
But let's keep it simple. This should not become a second changelog.