Python team wraps version 3.11.0
Latest release brings better speed and more comprehensible error messages
Python 3.11.0, the latest iteration of the exceedingly popular programming language, debuted on Monday, to the delight of software developers who care about such things.
"In the CPython release team, we have put a lot of effort into making 3.11 the best version of Python possible," said Pablo Galindo Salgado, a Python steering council member, via Twitter. "Better tracebacks, faster Python, exception groups and except*, typing improvements and much more."
The marquee feature of v3.11.0 is pure speed, something Python has historically (sometimes unjustly) accused of lacking.
"Python 3.11 is up to 10-60 percent faster than Python 3.10," said Salgado, and fellow release team members Ned Deily and Steve Dower, in the release announcement. "On average, we measured a 1.22x speedup on the standard benchmark suite."
Python still falls short of C, C++, or Rust – which fare far better in specific speed benchmarks – but that's not where Python excels.
For those writing Python, the arrival of Python Enhancement Proposal (PEP) 657 may be a greater thrill. PEP 657 makes certain Python error messages clearer by providing more information to developers. And this makes it easier to find and fix flaws.
- Is it time to retire C and C++ for Rust in new programs?
- Alert: 15-year-old Python tarfile flaw lurks in 'over 350,000' code projects
- Nearly one in two industry pros scaled back open source use over security fears
- Demand for software experts pushes tech salaries higher in UK
"The improved error messages are a real joy," said Raymond Hettinger, a core Python developer and instructor, via Twitter. "When the final release happens, likely later today, do yourself a favor and upgrade immediately."
The language's newfound verbosity comes at a cost – it increases the size of
pyc files (compiled bytecode created by the Python interpreter) on disk and the size of code objects in memory. While the Python development team believes the increased file size (+22% or 6MB for the standard library's pyc files) is worth it, they've provided an opt-out mechanism in the form of an environmental variable.
PEP 680, meanwhile, brings another useful feature, support for parsing TOML in the Python Standard Library. TOML is used for configuration files and has become more popular in the Python community since the pyproject.toml file was adopted as a main configuration file for Python packaging.
Data scientists may appreciate PEP 646, Variadic Generics, which lets you use generics to type constructors. It will help make array structures in numerical computing libraries like NumPy and TensorFlow work better with static type checkers.