Python 3.11 Stable Released, 1.25x Faster Than 3.10



On October 25, 2022, Python 3.11 stable was released. Python 3.11 is on average 1.25x faster than 3.10 due to the introduction of Faster CPython .

Python 3.11.0 final is now available - Committers - Discussions on Python.org
https://discuss.python.org/t/python-3-11-0-final-is-now-available/20291

3.11.0 Documentation
https://docs.python.org/3.11/

Faster CPython is a Python acceleration project launched by Mark Shannon in 2020 with the goal of ``making Python five times faster in four years''. With the introduction of this Faster CPython, Python 3.11 has been speeded up by 10% to 60% from Python 3.10, and it is said that an average speedup of 1.25 times has been achieved.

Mailman 3 [Python-Dev] Speeding up CPython - Python-Dev - python.org
https://mail.python.org/archives/list/[email protected]/message/RDXLCH22T2EZDRCBM6ZYYIUTBWQVVVWH/

Other improvements include:

PEP-657 : Traceback adds error location details
The Traceback displayed by the Cpython interpreter adds a mapping from each bytecode instruction to the starting and ending column offsets of the line that produced them, and the ending line number. For example, the error part is highlighted with '~~~~' and '^^^^' as shown below.



PEP-654 : Exception Groups and except*
An exception type 'ExceptionGroup' was introduced to allow multiple unrelated exceptions to be raised and handled simultaneously. It also introduces 'except*' as a new syntax for handling ExceptionGroups. Additionally, an add_note() method has been added to add a note to a BaseException. Added notes will be visible in Traceback.

PEP-680 : Support for TOML parsing in the standard library
The tomllib module has been added to the standard library, allowing you to parse TOML (Tom's Obvious Minimal Language) .

gh-90908 : Introduce task groups to 'asyncio'
A class called asyncio.TaskGroup that can process multiple tasks at the same time has been added to asyncio, the official library that realizes parallel processing with asynchronous I/O. You will be able to cancel

gh-34627 : Added atomic group and quantifier regular expressions
Added new regular expressions '(?>...)' '*+' '++' '?+' '{m,n}+'.

PEP-673 : Adding Self Types
Using typing.Self allows us to define ourselves dynamically, making it easy to get the class the method we want to define belongs to.

PEP-646 : Variable Length Generics
Python 3.11 introduced 'TypeVarTuple', which allows variables to be of any number of types. In particular, it will be possible to variableize the types of array-like structures in numerical libraries such as NumPy and TensorFlow, allowing static type checkers to detect bugs in code that uses these libraries.

PEP-675 : Arbitrary String Constants
Previously, in type hints, there was no way to specify arbitrary string constants with type annotations, so you had to specify them like Literal['foo']. Python 3.11 adds the LiteralString type for string constants, allowing functions to accept arbitrary literal strings such as Literal['hoge'] and Literal['foo'].

PEP-655 : TypedDict now allows individual elements to be optional or not
Two notations are introduced in a TypedDict: 'Required[]', which marks certain elements as required, and 'NotRequired[]', which makes certain elements potentially missing. Until Python 3.10, you could only choose between requiring all elements in a TypedDict or making all elements optional. However, starting with Python 3.11, it is possible to determine whether an element is required or not on an individual basis.

PEP-681 : dataclass conversion
By decorating with dataclass_transform, even third-party classes that have an error in the python type checker of dataclass specifications can be type-checked with the same specifications as dataclass.

in Software, Posted by log1i_yk