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
except
syntax. Exception Groups allow you to handle multiple exceptions with a single except clause. Theexcept
syntax allows you to handle all exceptions with a singleexcept
clause. - 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
Self
type. - 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
future
statement. - The
print
statement. - The
exec
statement. - The
with
statement with a bare string. - The
yield
from expression with a bare string. - The
yield
expression with a bare string.
- The
I hope this helps!