The latest version of the Python 3.11 programming language has been revealed, with the development team claiming that the new version might be the best yet.
In the Release Notes (Opens in a new tab)Pablo Galindo Salgado, a member of the Python Steering Council and the current release manager, along with fellow team members Steve Dower and Ned Daily, wrote that the team “put a lot of effort into making 3.11 the best possible version of Python”.
They also included the main improvements in Python 3.11: “better traces”, “faster Python”, and “exceptions and except* collections”, as well as introducing various typing improvements.
Latest Python 3.11 Improvements
The Python release team claimed in the release notes that Python 3.11 is “up to 10-60 percent faster than Python 3.10,” and reported measuring 1.22x acceleration on average, courtesy of Faster CPython project (Opens in a new tab).
Although it’s worth noting that this probably only applies to pure Python code, and that Python itself has never been the fastest programming language out there, this is still pretty impressive.
Many Python Improvement Proposals (PEPs) promise to deliver more tangible quality of life improvements.
657 (Opens in a new tab)For example, it will provide more detailed error reports for traces – detailed reports on function calls within a Python script, making debugging more straightforward. Pep 680 (Opens in a new tab)in the meantime, means that Python will be able to parse TOML files, which are commonly used for configuration files without the need for an external library.
But as record (Opens in a new tab) Reports suggest that PYC files compiled by the Python interpreter are now, on average, 22% larger, and while the Python team stands by the change, they’ve released an opt-out option, in the form of “PYTHONNODEBUGRANGES,” a new environmental variable.
Pep 654 (Opens in a new tab)on the other hand, allows handling of many exceptions simultaneously with the introduction of exception groups and the new syntax except *.
Python 3.11 should also encourage developers to use data types more, thanks to some new features and more subtle changes that give developers more control over the backend.
Probably the best example of that Pep 675 (Opens in a new tab)which allows users to declare random string types, but there are also Pep 673 (Opens in a new tab) (self-type), an intuitive way to annotate methods that return instances of the same class. finally, 646 (Opens in a new tab) (Variadic Generics), allowing medicines to store several types at once for later assignment to organisms.