This is a personal list of what I really liked (and disliked) about each release of Python.
3.11
- 19% speed improvement
- more informative KeyError handling
- TOML batteries included
3.10
- Better messages for syntax errors e.g. "SyntaxError: { was never closed"for line 1 where the curly brace started rather than"SyntaxError: '{' was never closed"for line 3 which was an innocent line
- Note – Structural Pattern Matching should be considered more of an anti-feature given its problems and its limited benefits for a dynamically typed language like Python
3.9
- String methods removesuffix and removeprefix (NOT same as rstrip() as that works on the letters). Note – absence of underscores in method names
- Union operator for dicts (new dict which is an update of the first by the second) e.g. up_to_date_dict = orig_dict | fresh_dict
3.8
- f-strings support e.g. f"{var=}"
- walrus operator :=(an antifeature with costs that outweigh benefits)
- positional-only parameters (so can change names without breaking code) – like extending list comprehensions to cover dictionaries, sets, and tuples it completes the coverage as you’d expect
3.7
- Nothing
3.6
- f-strings (massive)
- Underscores in numbers e.g. 3_500_000 – as a data guy this is huge
