Get ready for the best version yet of Python. The development team behind Python 3.11, the most recent version of the programming language, believes it may be the finest one yet.
Pablo Galindo Salgado stated in the release notes that the team “spent a lot of effort into producing 3.11 the best version of Python possible.”
Along with numerous typing enhancements, they also noted the important features of Python 3.11. “Improved tracebacks,” “faster Python,” “exception groups, and except*.”
The best version yet: newest Python 3.11 improvements
According to the Python release team’s release notes, Python 3.11 “is up to 10-60 percent quicker than Python 3.10,”. And the Faster CPython Project reported measurable speedups of 1.22x on average (opens in new tab).
Even if Python has never been the quickest programming language out there, that’s still outstanding.
More tangible quality-of-life enhancements are promised by a number of Python Enhancement Proposals (PEPs).
PEP 657, for instance, would add more thorough error reports for tracebacks. Which are reports of function calls made by a python script. This will make debugging much easier. In contrast, PEP 680 allows Python to parse TOML files, which are frequently used as configuration files, without the necessity of an external library.
The Python team has provided an opt-out in the form of “PYTHONNODEBUGRANGES,”. A new environmental variable, despite the fact that PYC files generated by the Python interpreter are now 22% larger.
On the other side, PEP 654 introduces exception groups and a new except* syntax. That enables the handling of many exceptions simultaneously.
Thanks to several new capabilities and some subtle modifications that allow developers more flexibility in the backend, Python 3.11 should also encourage developers to use data types more frequently.
The PEP 675, which enables users to specify arbitrary string types, may serve as the finest example of this, while PEP 673 (the Self Type), which provides a natural way to annotate methods that return instances of the same class, is another option. Last but not least, PEP 646 (Variadic Generics) enables generics to simultaneously hold several types for eventual assignment to objects.