

Errors are raised using exception groups, so no error will pass silently. The idea of TaskGroup is to run nested tasks and continue running them even if one fails. AsyncIO Task Groupsįor those who switched from JavaScript to Python and await the functionality of JS, this is the most exciting feature addition. – A new syntax except* for handling ExceptionGroup. – A new standard exception type, the ExceptionGroup, represents a group of unrelated exceptions being propagated together. This document in Python 3.11 proposes language extensions that allow programs to raise and handle multiple unrelated exceptions simultaneously:

This way you can specify the input type of the function parameters and the return type of the value the function returns. Function Annotation is a feature that allows you to add metadata to function parameters and return values. In this version, there is a Self Type, which is part of the Python 3 feature that allows users to annotate functions. This is leading to an almost 3–7% speedup in pyperformance. As a result, nearly all Python function calls have sped up significantly. – For most user codes, no frame objects are created at all. Old-style frame objects are now created only when required by debuggers. Previously, frames held extra debugging and memory management information. – Reduced the amount of information held by a frame by streamlining its internal frame struct. – Avoided memory allocation by generously re-using frame space on the C stack. – Streamlined the frame creation process to make it faster.

The Runtime in Python 3.11 is faster than in the previous versions, thanks to the following new frame optimizations: This has a big impact on short-running programs using Python. Interpreter startup is 10–15% faster in Python 3.11. In this version, Python caches the bytecode in the _pycache_ directory to speed up the process of loading modules. The speed boost focuses on two main areas: faster startup and faster runtime. CPython 3.11 is on average 1.22x faster than CPython 3.10, and the speedup could be up to 10-60% faster. In version 3.11, the CPython interpreter is much more optimized and much faster than in version 3.10. This feature will point to the exact expression that caused the error instead of just the line as in the previous versions.

It has a better error-locating feature in the tracebacks. So in this latest version, Python has handled this error. But in this case, the marker points out intuitively where is the incorrect part, so you can immediately see that the “last” item is an expected field nested inside the name. You still get the same KeyError because of a missing last field.
