From time to time I need to poke someone to use a new version of Python but I couldn't find the list of main features one gets by this. There is https://docs.python.org/3/whatsnew/index.html but that is too much info. So here is my concise list. Also, there is an EOL (End of Life) date for every version in the brackets. More visual EOF site at https://devguide.python.org/versions/
Python 3.13 (2029-10)
- New colorful interactive REPL
- Experimental GIL removal
- Experimental JIT compiler
- Support for mobile platforms like iOS and Android soon
Python 3.12 (2028-10)
- New Type Parameter Syntax for generics in functions
def max[T](args: Iterable[T]) -> T:
classesclass list[T]:
and typestype Point[T] = tuple[T, T]
-
Nested f-strings
f"{f"{f"{f"{f"{f"{42-36}"}"}"}"}"}"
- A per-interpreter GIL
Python 3.11 (2027-10)
- between 10-60% speedup
- Fine-grained error locations in tracebacks
- Enhanced error locations in tracebacks
- Support for parsing TOML files in the Standard Library
Python 3.10 (2026-10)
match point:
case Point(x=0, y=0):
print("Origin is the point's location.")
case Point(x=0, y=y):
print(f"Y={y} and the point is on the y-axis.")
case Point(x=x, y=0):
print(f"X={x} and the point is on the x-axis.")
case Point():
print("The point is located somewhere else on the plane.")
case _:
print("Not a point")
-
Type alias
StrCache: typing.TypeAlias = "Cache[str]"
-
Union type operator
def square(number: int | float) -> int | float:
- Better error messages with precise line numbers for debugging and other tools
- Parenthesized context managers
with (
CtxManager1(),
CtxManager2()
):
...
Python 3.9 (2025-10)
-
Dictionary merge
assert {"a": 1} | {"b": 2} == {"a": 1, "b": 2}
-
New string methods
str.removeprefix(prefix)
andstr.removesuffix(suffix)
-
Builtin Generics
list[dict[str, int]]
vs.typing.List[typing.Dict[str, int]]
- New PEG parser
-
New module
zoneinfo
for timezones information
Python 3.8 (2024-10)
-
The walrus operator
if (n := len(a)) > 10: print(f"List is too long ({n} elements, expected <= 10)")
-
Positional-only parameters
len(obj, /)
which prevents awkward calls such aslen(obj="Hello")
-
Self documenting f-strings
f"{user=} {member_since=}" # "user='eric_idle' member_since=datetime.date(1975, 7, 31)"
-
cached_property
is finally in the standard library
Python 3.7 († 2023-06)
@dataclass
class Point:
x: float
y: float
z: float = 0.0
p = Point(1.5, 2.5)
print(p) # produces "Point(x=1.5, y=2.5, z=0.0)"
- Built-in breakpoint function
Python 3.6 († 2021-12)
-
f-strings
f'Hello {name}'
-
undescores in number literals
10_000_000
-
variable annotations
variable: Type = 29
- asynchronous generators and comprehensions
async def ticker(delay, to):
"""Yield numbers from 0 to *to* every *delay* seconds."""
for i in range(to):
yield i
await asyncio.sleep(delay)
result = [i async for i in aiter() if i % 2]
result = [await fun() for fun in funcs if await condition()]
- New module "secrets"
- Type
dict
is more compact and ordered by default
Python 3.5 († 2020-09-30)
async/await
syntax-
matrix multiplication operator
M @ N
-
Additional Unpacking Generalizations
print(*[1], *[2], 3, *[4, 5])
andfunction(**{'a': 1, 'c': 3}, **{'b': 2, 'd': 4})
-
New enum for HTTP statuses
http.HTTPStatus.OK
-
Type hints
typing.Dict[str, typing.Any]
Python 3.4 († 2019-03-18)
Python 3.3 († 2017-09-29)
- Built-in virtualenv
-
Generator delegation
yield from another_generator()
-
Exception context suppresion
raise Exception("Ooops") from None
-
Explicit unicode literals are back to make migration from Python 2 easier
u"I am unicode in both Python 2 and 3"
- New module
unittest.mock
- New module
ipaddress
Python 3.2 († 2016-02-20)
Python 3.1 († 2012-04-09)
OrderedDict
-
with
handles multiple context managers in single statement
Top comments (1)
LOL for the last item in the list😂