see also #85
use data class
@DataClass
Here is a list of some notable new functionalities introduced in Python 3.10 and Python 3.11:
Python 3.10
-
Structural Pattern Matching:
- Introduction of the
match statement with case clauses, enabling powerful and expressive pattern matching.
-
Parenthesized Context Managers:
- Allowing the use of multiple context managers within a single
with statement using parentheses.
-
Precise Line Numbers for Debugging and Profiling:
- Enhancements in the CPython implementation to provide more precise line numbers, improving debugging and profiling accuracy.
-
Parameter Specification Variables:
- Addition of
ParamSpec and Concatenate to typing, allowing for better type hints for decorators and higher-order functions.
-
Type Aliases:
- The
TypeAlias annotation, introduced to clarify when a variable is a type alias.
-
Improved Error Messages:
- More informative and detailed error messages for better debugging and understanding of errors.
-
New Syntax Features:
- Parenthesized context managers.
| operator for union types (e.g., int | float).
-
Deprecations and Removals:
- Deprecated some legacy modules and features, such as
distutils.
Python 3.11
-
Exception Groups and except*:
- Introduction of
ExceptionGroup and the except* syntax to handle multiple exceptions simultaneously.
-
Faster CPython:
- Various performance improvements, making CPython execution faster (up to 10-60% in many scenarios).
-
New Syntax Features:
- Introduced the
self type for more accurate method type hints in classes.
- Enhanced error messages with better clarity and information.
-
Fine-Grained Error Locations:
- More precise locations for errors, especially in complex expressions.
-
Task and Coroutine Profiling:
- Improved support for profiling tasks and coroutines, allowing better performance monitoring in asynchronous code.
-
Tomllib for TOML Parsing:
- A new standard library module
tomllib for parsing TOML configuration files.
-
Typing Improvements:
- Enhancements to typing, including variadic generics and parameter specifications.
-
Enhanced Annotations and Typing:
- Improved support for type hints and annotations, including
LiteralString and Required.
-
Deprecations and Removals:
- Continued deprecations and removals of legacy features and modules, aligning with Python's evolving standards.
-
test GIL
-
test JIT compiler
see also #85
use data class
@DataClass
Here is a list of some notable new functionalities introduced in Python 3.10 and Python 3.11:
Python 3.10
Structural Pattern Matching:
matchstatement withcaseclauses, enabling powerful and expressive pattern matching.Parenthesized Context Managers:
withstatement using parentheses.Precise Line Numbers for Debugging and Profiling:
Parameter Specification Variables:
ParamSpecandConcatenatetotyping, allowing for better type hints for decorators and higher-order functions.Type Aliases:
TypeAliasannotation, introduced to clarify when a variable is a type alias.Improved Error Messages:
New Syntax Features:
|operator for union types (e.g.,int | float).Deprecations and Removals:
distutils.Python 3.11
Exception Groups and
except*:ExceptionGroupand theexcept*syntax to handle multiple exceptions simultaneously.Faster CPython:
New Syntax Features:
selftype for more accurate method type hints in classes.Fine-Grained Error Locations:
Task and Coroutine Profiling:
Tomllib for TOML Parsing:
tomllibfor parsing TOML configuration files.Typing Improvements:
Enhanced Annotations and Typing:
LiteralStringandRequired.Deprecations and Removals:
test GIL
test JIT compiler