Python 3.10: What’s New?

blog_img
Here is a gist of Python features that append to the existing ones in the upcoming Python 3.10!

As of June 2021, Python 3.9 is the latest, and 3.10.0 b2 is coming up next. It is in beta testing enabling a larger audience to check the features and work upon bug fixes. New changes in Python 3.10 are not revolutionary but good to have. Let’s take a look:

What’s new in Python 3.10?

Structural pattern matching – Python makes use of structural pattern making covering up for switch/case-like syntax. It enables matching up for a set of values to be usable across various scenarios.

structural pattern matching

Precise Error Reporting – Python 3.10 goes along with the new parser, which is faster, robust, and easier for the Python team to maintain. It makes it easier to develop, generate syntax errors, and showcase relevant error messages.

precise error reporting

Parameter specification variables – Python’s new syntax lets you describe the module and the callable (function). Information propagation across callable is an issue, which makes annotation of function decorators unmanageable.

‘typing.ParamSpec’ and ‘typing.Concatenate’ make it easy to annotate callables with more abstract type definition information.

parameter specification variables

You cannot pass every possible detail with the linter – (1) What types should you ‘pass’ to the functions that the decorator processes etc. The linter cannot catch the invalid types. To make it work with a new parameter specification variable syntax:

new parameter specification variable syntax

ParamSpec indicates the positional and keyword arguments. Concatenate depicts how ‘arguments’ are added or removed with decorators.

Better Context Managers – Python 3.10 enables enclosing parenthesis for continuation across multiple text lines in context managers. It allows you to manage multiple files in a much more organized manner.

More Changes in Python 3.10

  • Now Union Types are expressed as Union [X|Y] instead of X|Y.
  • The zip built-in integrates multiple iterations within a strict keyword. If the value is positive, it causes zip to raise an exception if one of the iterations is exhausted before the others.
  • With statement now supports multi-line, parenthetical syntax.
  • Variables are declared as type aliases, allowing forward references, robust errors involving types, distinct type declarations in scopes.
  • CPython requires OpenSSL 1.1.1 or higher to modernize one of its dependencies.

Also read:

Conclusive: Where can we go from here?

Python 3.10 is in the alpha stage of development and ready for beta testing – bug fixes and improvements before deployment. It will bring about changes in (1) Error messages, (2) Structural Pattern Matching (Switch Statement), (3) The Union Operator, (4) Better Context Managers. It will make things simpler and more organized. However, it will not bring changes to the Python code. We described just a bit of what is going to change in an upcoming update. Follow complete Python Documentation for details. Contact Konstant’s Python Development Company if you wish to create a Python Application!

YOU MAY ALSO LIKE
About Author
Neeti Kotia

Neeti Kotia

Neeti Kotia is a technology journalist who seeks to analyze the advancements and developments in technology that affect our everyday lives. Her articles primarily focus upon the business, social, cultural, and entertainment side of the technology sector.

MAKE YOUR IDEA REACH ITS GRAND DESTINY

WITH PRO WEB AND MOBILE SOLUTIONS

Looking for a development partner?

Portfolio

Visit Our Portfolio

Top Mobile Blog Winner

Top 15 Latest Mobile Blogs

Mobile App Blog Winner

Mobile App Blogs

SUBSCRIBE TO OUR BLOG

Top

Get a perfect quote

We’re eager to work with you. Please share your project goals and contact information. We respond to 97% of messages within 1-2 business day. Really!

Or send us an email at: [email protected]