Python 3.10 Released
Python Programming Language
Next major Python release, Python 3.10 has just been released.
I’m only a beginner with Python development, but from reading articles it seems this version brings a few really great improvements.
Improved Error Messages Precision
If you ever had to debug modern code, you probably know how easy it is to get a cryptic error message that doesn’t correctly describe the issue OR even point to the exact line that cause it.
Building on the parser improvements made back in Python 3.9, this new Python version achieves a much better precision of both when and how error messages are delivered.
A better error message will now include helpful suggestions, like this:
Improved Type Aliases Syntax
Type aliases are now going to be done using construct like this:
This is believed to improve both readability for developers and reliability for parsers recognising type aliasing.
Multi-Line Context Manager (with)
It’s now possible to use parenthesis for creating multi-line context managers, thus improving readability while also achieving better formatting for nested expressions, like this:
Pattern Matching
I don’t code enough to appreciate this feature fully, but apparently it’s a big deal: it’s now possible to do case-style pattern matching by not just simple/static values but also complex expressions - all with the elegance typical for a Python code.
Look Structural Pattern Matching up, it’s supposed to be a great thing.
Here’s a simple example of pattern matching in Python 3.10:
Union Types Syntax
Again, I don’t consider myself qualified enough to comment on this - so read more in PEP 604.
Performance Improvements
There are performance improvements across the board: always a welcome change.
See Also
Python Programming Language
Next major Python release, Python 3.10 has just been released.
I’m only a beginner with Python development, but from reading articles it seems this version brings a few really great improvements.
Improved Error Messages Precision
If you ever had to debug modern code, you probably know how easy it is to get a cryptic error message that doesn’t correctly describe the issue OR even point to the exact line that cause it.
Building on the parser improvements made back in Python 3.9, this new Python version achieves a much better precision of both when and how error messages are delivered.
A better error message will now include helpful suggestions, like this:
Improved Type Aliases Syntax
Type aliases are now going to be done using construct like this:
This is believed to improve both readability for developers and reliability for parsers recognising type aliasing.
Multi-Line Context Manager (with)
It’s now possible to use parenthesis for creating multi-line context managers, thus improving readability while also achieving better formatting for nested expressions, like this:
Pattern Matching
I don’t code enough to appreciate this feature fully, but apparently it’s a big deal: it’s now possible to do case-style pattern matching by not just simple/static values but also complex expressions - all with the elegance typical for a Python code.
Look Structural Pattern Matching up, it’s supposed to be a great thing.
Here’s a simple example of pattern matching in Python 3.10:
Union Types Syntax
Again, I don’t consider myself qualified enough to comment on this - so read more in PEP 604.
Performance Improvements
There are performance improvements across the board: always a welcome change.