It took the Python community a long time to move from Python 2 to Python 3. Now as we approach the possible end of Python 3 version history, we are approaching a potential Python 4.
What to expect in Python 4
Other than Python version 4 being mentioned in the PEP documentation, there is currently no formal writeup of the Python 4 feature-set.
Therefore we have to either believe that it will be the next version after 3.9, and will simply become 3.10. Otherwise it will fall back to version 4.
The industry argument around this continuing to 3.10 is based on the point that a major version bump from 3.* to 4.* should only be for breaking backward compatibility. Such as directed by
semver (the Semantic Versioning standard).
Therefore, we can mention the primary features we would like to see in the next iteration. If it is to break version compatibility, then we will push some requests into the Version 4 Core branch.
What we want to see in Python 4
As a software engineer by trade, when working between languages, it becomes quite evident which features are superior in certain languages compared to other languages.
For concurrent programming paradigms, Golang has
goroutines, Kotlin has
coroutines, Java has the introduction of
streams, which is taken one step further with ReactiveX and
rxJava in particular. Even NodeJS is non-blocking by default, yet Python still lives in the dark ages with it’s single-threaded approach to software engineering.
Yes, there are ways to achieve concurrency, such as making use of the Multiprocessing libraries, or Asyncio. But all these approaches seem a bit haphazard and more challenging than they should be.
A core functionality and pythonic way of doing concurrent programming would be right near the top of the Python 4 wish-list.
Another feature to find it’s way as a primary contender, would be that of a way to statically compile code to a single binary. A cross platform way to do this would be first prize, but either way would be nice.
There are ways to achieve a similar thing, such as using Nuitka to automatically transpile Python project to C and then compile that seamlessly to a native binary. This actually works pretty well, and you can read more about it here.
It would be great if there were a built-in way to achieve this from the language itself.
What we still have in version 3
Main features in Python 3.7
Python 3.7 comes with many enhancements, such as the
asyncio mobile having received new features and significant usability and performance improvements.
Improvements to the data model, in particular the
Enhancements and some postponements to the Evaluation of Annotations within the language.
A new forced UTF-8 runtime mode, where CPython ignores the locale settings and uses UTF-8 by default.
The time module received the ability to work with
Additionally to all of this, there were also quite a few new modules for working with data collections, import libraries and overall improvements in many of the standard modules.
To see all the changes, view the list here.
Main features in Python 3.8
The Walrus operator
This can be used to assign a variable while using it, for example:
There is a new function parameter syntax
/ to indicate that some function parameters must be specified positionally and cannot be used as keyword arguments. This is the same notation shown by
help() for C functions annotated with Larry Hastings’ Argument Clinic tool.
In the following example, parameters a and b are positional-only, while c or d can be positional or keyword, and e or f are required to be keywords:
There are various other features, view them all here.
Main features in Python 3.9
Python 3.9 seems to be getting ready for a Python 4 on the horizon, with the removal of DeprecationWarning sections in the code that was used around Python 2.7 to Python 3.* migrations.
We are starting to see the removal of older versions compatibility.
Along with this, there are going to be new operators on the Dictionary type, such as
update. As well as some
removesuffix methods on the
There is also a new parser and various other language changes. For a full breakdown, see this Whats New page.
What’s your take?
Please leave your comments below for which features you would like Python 4 to prioritise and work towards building.