Python 3.9.0

A new stable release of the popular Python programming language has been released.

Python is a high-level, general-purpose programming language focused on improving developer productivity and code readability. The main features are dynamic typing, automatic memory management, full introspection, exception handling mechanism, support for multi-threaded calculations, high-level data structures.

Python is a stable and widespread language. It is used in many projects and in various capacities: as a main programming language or for creating extensions and integrating applications. Main applications: web development, machine learning and data analysis, automation and system administration. Python is currently in third place in the ranking. TIOBE.

Major changes:

New high-performance parser based on PEG grammars.

In the new version, the current Python parser based on LL(1) grammars (CL-grammar) is replaced with a new high-performance and stable parser based on PEG (PB-grammar). Parsers for languages ​​represented by COP grammars, such as LR parsers, require a special lexical analysis step that splits the input according to spaces, punctuation, and so on. This is necessary because these parsers use pre-parsing to process some CFGs in linear time. RW grammars do not require a separate lexical analysis step, and the rules for it can be laid down along with other grammar rules.

New operators and functions

Two new operators have been added to the built-in dict class, | to merge dictionaries and |= to update.

Two new functions have been added to the str class: str.removeprefix(prefix) and str.removesuffix(suffix).

Type hinting for built-in collection types

This release includes support for generator syntax in all standard collections currently available.

def read_blog_tags(tags: list[str]) -> None:
for tags in tags:
print("Tag Name", tag)

Other changes

  • PEP 573 Accessing Module State with C Extension Methods

  • PEP 593 Flexible functions and variable annotations

  • PEP 602 Python moves to annual stable releases

  • PEP 614 Relaxing grammar restrictions on decorators

  • PEP 615 IANA Database Support for Time Zones in the Standard Library

  • BPO 38379 Garbage collection does not block on restored objects

  • BPO 38692 os.pidfd_open, to control processes without races and signals;

  • BPO 39926 Updated Unicode support to version 13.0.0

  • BPO 1635741, Multiple initialization of Python in the same process no longer leaks memory

  • Python collections (range, tuple, set, frozenset, list, dict) speeded up with PEP 590 vector call

  • 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 the stable ABI defined by PEP 384.

Source: linux.org.ru

Add a comment