Here are some of the new features in Python 3.11:
- Fine-grained error locations in tracebacks. Python 3.11 now provides more information about the location of errors in tracebacks. This can help you to quickly identify the source of an error and fix it.
- Exception Groups and except*. Python 3.11 introduces Exception Groups and
the
exceptsyntax. Exception Groups allow you to handle multiple exceptions with a single except clause. Theexceptsyntax allows you to handle all exceptions with a singleexceptclause. - New Features Related to Type Hints. Python 3.11 introduces a number of new
features related to type hints. These features include:
- Variadic generics.
- Marking individual TypedDict items as required or not-required.
- The
Selftype. - Arbitrary literal string type.
- Data class transforms.
- Other Language Changes. Python 3.11 also includes a number of other language
changes, such as:
- Support for TOML configuration parsing.
- Faster CPython.
- Faster Startup.
- Frozen imports / Static code objects.
- CPython bytecode changes.
- New opcodes.
- Deprecated. Python 3.11 deprecates a number of features, such as:
- The
futurestatement. - The
printstatement. - The
execstatement. - The
withstatement with a bare string. - The
yieldfrom expression with a bare string. - The
yieldexpression with a bare string.
- The
I hope this helps!