Member-only story
What’s New In Python 3.11.0?
Just lately I was covering for you Python 3.10.8, and now 3.11.0 is here. A stable release made on 24/10/2022.
Python 3.11.0 is all about better error communication, improved strong typing and performance improvements. Let’s dive into the new features!
Let's start with one every developer will fall in love with in a second. There will be a bonus, if you read to the end!
Precisely Showing What Causes An Error
For a developer it is crucial to know what causes an error. Unfortunately, sometimes all we had was a line number.
Python 3.11.0 introduces a more fine-grained feedback thanks to Pablo Galindo, Batuhan Taskaya and Ammar Askar. As we can read in the PEP (Python Enchantment Proposal):
This PEP proposes adding a mapping from each bytecode instruction to the start and end column offsets of the line that generated them as well as the end line number. This data will be used to improve tracebacks displayed by the CPython interpreter in order to improve the debugging experience.
Below you can see an example of the new, lovely error log:

Concurrent code debugging will become easier too!
Exception Grouping For Better Error Understanding
The second improvement makes it easier to group exceptions. Instead of filling up the error log with a pile of seemingly unrelated errors, now Python will combine errors to make it easier to recognize their origin.

It will be especially helpful when using asynchronous code. We should see more benefits from this feature once libraries start to use grouped exceptions.
The exception grouping feature also comes with a new keyword except* making it easier to handle grouped exception scenarios: