This is going to be mainly my cheatsheet for different python syntax and standard library changes, because I often work with multiple Python versions across projects and I never remember which feature was released in which major Python version.
Also I'll only list only what I consider major for my use cases, a.k.a. the features I use the most. For the rest, I can always look it up.
3.13
- We can disable GIL, but that requires
python3-freethreading(on Fedora) - Experimental JIT
- 🗑️ Removed
lib2to3
3.12
- More flexible f-string parsing (quotes inside f-strings, nested f-strings)
- Improved error messages
@overridedecorator- Generic types:
def func[T](it: Iterable[T]) -> T: - Easier alias type using
type:type MyType = list[str] - 🗑️ Removed
assertEqualsand similar old style named methods inunittest - 🗑️ Removed
distutils
3.11
- Fine-grained error locations in tracebacks
- Exception groups
Selftype- Speed up 🚀
- tomllib
3.10
- Union types (
X | Y) matchstatementTypeAlias
3.9
- Union operator in
dict(d1 |= d2) str.removeprefixandstr.removesuffix- Type hinting generics:
list,dict,setinstead oftyping.List, etc...
3.8
- Walrus operator (
:=) - Positional only arguments (
pow(x, y, /)) - f-string
=format for debugging LiteraltypesTypedDict
3.7
breakpoint()- dataclasses
3.6
- f-strings
dictkeys stored in order of insertion (CPython)
3.5
- Typing module