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:
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.
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.
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.
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:
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.
Also read:
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!
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.
Or send us an email at: [email protected]