Python 3.10 is the latest development version of Python. Intrepid Python developers are advised to take appropriate precautions to test their code.

Python 3.10 doesn’t have many new key features, but one of the few features it has, structural pattern matching, could be the only most important addition to the language syntax.

Structural pattern matching

The result of an additional attempt that previously failed switch/case-Similar to Python syntax, structural pattern matching allows variables to match one of a set of possible values ​​(switch/case in other languages). However, you can also collate with a pattern of values. This greatly expands the range of possibilities and allows you to write code that quickly covers different scenarios.

More accurate error reporting

Python error reporting has long been at the mercy of the parser’s whims. Python 3.9 rolled out All new parser — The Python team is faster, more robust, easier to maintain, and less plagued by internal hacks.

Parameter specification variable

The Python typing module used to annotate code with type information allows you to describe the types of callable objects (such as functions). However, that type of information cannot be propagated between callable objects. This makes it difficult to annotate function decorators and the like.

Two new additions to typing, typing.ParamSpec – when typing.Concatenate, it allows you to annotate callable objects with more abstract type definition information.

Other major changes in Python 3.10.

  • Union types can be expressed as: X|Y, Excluding that Union[X,Y], To be concise (PEP 604).
  • NS zip The built-in that combines the results of multiple repeatable objects strict keyword. When set to True, That’s the cause zip Raises an exception if one of the iterables is exhausted before the other iterables (PEP 618).
  • You can now declare variables as type aliases. This improves forward references, more robust type-related errors, and the distinction between in-scope type declarations (PEP 613).
  • OpenSSL 1.1.1 or later is required to build CPython. This will update one of CPython’s major dependencies (PEP 644).
Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
java2days conference link

Most popular in DevStyleR

Update One

Update One

10 May, 2022
Gameloft

Gameloft

9 May, 2022
Droxic

Droxic

27 April, 2022
Tarya Fintech Bulgaria
Carista

Carista

19 April, 2022