Python 3.10: What To Expect

26Mar - by aiuniverse - 0 - In Python

Source –

According to a recent study, almost 27% of the advertised jobs require Python as a core skill, up from 18.5% at the beginning of the year.

Python is one of the TIOBE Index programming languages of the year. It has become the go-to language for developers working on data science and machine learning for a few years now. 

What sets Python apart is its intuitive features like libraries, high productivity, ease of learning etc. According to a recent study, almost 27% of the advertised jobs require Python as a core skill — up from 18.5% at the beginning of the year.

Last October, Python released version 3.9. The updates included improvements in Python internals, performance boosts, dictionary union operators, handy new string functions, new type operations, consistent and stable internal APIs and more.

What To Expect From 3.10

Python started work on the upcoming version, Python 3.10 pre-alpha, in May 2020. Python version 3.10 is set to be released on 4 October 2021. 

However, with the pre-alpha, the company has unveiled an early developer preview of Python 3.10.

The current alpha version of 3.10 is 3.10.0a6, which is the sixth of seven planned alpha releases. During the alpha phase, features may be added up until the start of the beta phase and, if necessary, may be modified or deleted until the release candidate phase. 

The significant new features of the Python 3.10 version are mentioned below:

Structural Pattern Matching

The pattern matching feature has been added in the form of a match statement and case statements of patterns with associated actions. Patterns usually consist of sequences, primitive data types mappings, as well as class instances. Pattern matching will help developers extract information from various complex data types, branch on the structure of data, and apply specific actions based on different data forms.

Better Error Messages In The Parser

When parsing code that contains unclosed parentheses or brackets the interpreter now includes the location of the unclosed bracket of parentheses instead of displaying SyntaxError: unexpected EOF while parsing or pointing to some incorrect location. Previous versions of the interpreter reported confusing places like the location of the syntax error but in Python3.10 a more informative error is emitted.

Parameter Specification Variables

Parameter Specification Variables feature supports forwarding the parameter types of one callable over to another callable, making it difficult to annotate function decorators. This feature proposes typing.ParamSpec and typing.Concatenate that help in specifying the type of a callable. 

Precise Line Numbers for Debugging and Other Tools

According to its developers, Python should guarantee that when tracing is turned on, “line” the tracing events are generated for all lines of code executed and only for lines of code that are executed. A side effect of ensuring correct line numbers is that some bytecodes will need to be marked as artificial and to assist such tools, a new co_lines attribute will be added that describes the mapping from bytecode to source.

Deprecate Distutils Module

Distutils is an undocumented and unmaintained collection of utilities for packaging and distributing Python packages, including the compilation of native extension modules. This feature defines a configuration format that describes a Python distribution and provides the tools to convert a directory of source code into a source distribution and binary distribution forms.

In both the version of Python 3.10 and 3.11, distutils will be formally marked as deprecated. Meaning, all the known issues will be closed at this time, and import distutils will raise a deprecation warning. During Python 3.10 and 3.11, uses of distutils within the standard library may change to use alternative APIs. However, in Python 3.12, distutils will no longer be installed by make install or any of the first-party distributions. 

Facebook Comments