A new stable release of the popular programming language Python has been launched.
Python is a high-level, general-purpose programming language aimed at enhancing developer productivity and code readability. Key features include dynamic typing, automatic memory management, full introspection, exception handling mechanisms, support for multithreading, and high-level data structures.
Python is a stable and widely used language. It is employed in many projects and various capacities: as the primary programming language or for creating extensions and integrating applications. Major application areas include web development, machine learning and data analysis, automation, and system administration. Currently, Python ranks third in the TIOBE.
Key Changes:
A new high-performance parser based on PEG grammars.
In the new version, the current LL(1) grammar-based parser for Python has been replaced with a new high-performance, stable parser based on PEG (Parsing Expression Grammar). Parsers for languages represented by context-free grammars, such as LR parsers, require a separate lexical analysis step that breaks down the input according to spaces, punctuation, and so on. This is necessary because these parsers employ a preliminary analysis to process certain context-free grammars in linear time. PEG grammars do not require a separate lexical analysis step, and the rules for it can be embedded along with other grammar rules.
New operators and functions
Two new operators have been added to the built-in dict class: | for merging dictionaries and |= for updating.
Two new functions have been added to the str class: str.removeprefix(prefix) and str.removesuffix(suffix).
Type hint for built-in collection types
This release includes support for generator syntax in all currently available standard collections.
def read_blog_tags(tags: list[str]) -> None:
for tag in tags:
print("Tag Name", tag)
Other changes
PEP 573 Accessing module state via C extension methods
PEP 593 Flexible function and variable annotations
PEP 602 Python moves to annual stable releases
PEP 614 Relaxing grammar restrictions on decorators
PEP 615 IANA Time Zone Database Support in the Standard Library
BPO 38379 Garbage Collection No Longer Blocks on Recovered Objects
BPO 38692 os.pidfd_open for Managing Processes Without Races and Signals;
BPO 39926 Unicode Support Updated to Version 13.0.0
BPO 1635741, Multiple Initializations of Python in the Same Process Now No Longer Cause Memory Leaks
Python Collections (range, tuple, set, frozenset, list, dict) Accelerated Using Vector Call PEP 590
Some Python Modules (_abc, audioop, _bz2, _codecs, _contextvars, _crypt, _functools, _json, _locale, operator, resource, time, _weakref) Now Use Multi-Phase Initialization as Defined in PEP 489
A Number of Standard Library Modules (audioop, ast, grp, _hashlib, pwd, _posixsubprocess, random, select, struct, termios, zlib) Now Use a Stable ABI Defined by PEP 384.
Source: linux.org.ru
