New Features in Python 3.9 You Should Know About
Python 3.9 Beta is coming soon, so it’s time to explore some of its upcoming features like new dict operators, new functools and more…
--
The release of Python 3.9 is still quite a while away (5.10.2020), but with the last alpha (3.9.0a5) release out and first beta in near future, it feels like it’s time to see what new features, improvements and fixes we can expect and look forward to. This article won’t be an exhaustive list of every change, but rather a list of the most interesting and noteworthy things to come with the next version for us — developers. So, let’s dive in!
Installing Beta Version
To be able to actually try anything contained in the alpha/beta versions of Python 3.9, we first need to install it. Ideally alongside our existing Python 3.8 (or another stable version) installation so that we don’t mess up our default interpreter. So, to install the latest, greatest version:
After running this you should be greeted by IDLE and message like:
New Dict Operators
The most notable new feature is probably the new dictionary merging operator — |
or |=
. Until now, you would have to choose from one of the following 3 options for merging dictionaries:
The first option above uses dict(iterable, **kwargs)
function which initializes dictionaries - the first argument is a normal dictionary and…