Python 3.11 -
Before 3.11, if you ran multiple tasks and two failed with different errors, Python would raise the first exception and swallow the second. You would lose debugging information.
Notice the except* (star-except) syntax. It catches all ValueErrors inside the group without breaking the successful execution of task "B". Ask any developer: "What is the worst part of Python?" Many will answer: Tracebacks that only tell you the line, not the column. python 3.11
import tomllib with open("config.toml", "rb") as f: config = tomllib.load(f) print(config["tool"]["poetry"]["name"]) Before 3
Python 3.11 fixes this. When an error occurs, the interpreter now points an arrow ( ^ ) at the specific expression that failed, not just the line number. It catches all ValueErrors inside the group without
# Python 3.11+ from asyncio import gather, sleep async def risky_task(name, fail): await sleep(0.1) if fail: raise ValueError(f"name failed") return name
If you are starting a new project today, target . Your future self will thank you for the speed and clarity. Want to test it yourself? Install via pyenv or the official Python Docker image python:3.11-slim .