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
@override
decorator- Generic types:
def func[T](it: Iterable[T]) -> T:
- Easier alias type using
type
:type MyType = list[str]
- 🗑️ Removed
assertEquals
and similar old style named methods inunittest
- 🗑️ Removed
distutils
3.11
- Fine-grained error locations in tracebacks
- Exception groups
Self
type- Speed up 🚀
- tomllib
3.10
- Union types (
X | Y
) match
statementTypeAlias
3.9
- Union operator in
dict
(d1 |= d2
) str.removeprefix
andstr.removesuffix
- Type hinting generics:
list
,dict
,set
instead oftyping.List
, etc...
3.8
- Walrus operator (
:=
) - Positional only arguments (
pow(x, y, /)
) - f-string
=
format for debugging Literal
typesTypedDict
3.7
breakpoint()
- dataclasses
3.6
- f-strings
dict
keys stored in order of insertion (CPython)
3.5
- Typing module