Crunching Python Insider — Major new features of the 3.10 series, compared to 3.9
Crunching Python Insider goes through all the posts (since 1th Jan, 2021) published at the official Python blog (https://blog.python.org/) and explain what the announces really means and what are the benefits you can take out of the new features — with examples when possible — and what you need to worry about.
You will see this term a lot, PEP, but what is it?
It's a Python Enhancement Proposals, see it as documentation for all changes, adds, removals etc that happen in Python language or standard libraries.
Let's check what was announced
Publish date: Monday, January 4, 2021
This post talks about the most significant changes (up to the moment) that will be present at Python 3.10 -in Alpha phase-. Let's check one-by-one:
#1 PEP 623 — Remove wstr from Unicode
Back then, in PEP 393, some Unicode APIs got deprecated:
Now they will be removed completely from support.
Should you care about it? Trust me, if so, you would know.
More Information: https://www.python.org/dev/peps/pep-0623/
#2 PEP 604 — Allow writing union types as X | Y
That is a nice addition to Python. It will make the methods signatures and type specifications easier to write and to read.
The Operator Or in Python, expressed as |, can now be used for object types (remember that everything in Python is an object that belongs to a type).
Currently, if I want to make explicit the return type of a method, and this method can return a str or a None, you would write something like this:
Now you can simply: