Python 3.8 is the latest version of the popular language for everything from scripting and automation to machine learning and web development. Now available in an official beta release, Python 3.8 brings a number of slick syntax changes, memory sharing, more efficient serialization and deserialization, revamped dictionaries, and much more.
Naturally, Python 3.8 ushers in all manner of performance improvements as well. The overall result is a faster, more concise, more consistent, and more modern Python. Here’s what’s new and most significant in Python 3.8.
Assignment expressions
The single most visible change in Python 3.8 is assignment expressions, which use what is known as the walrus operator ( :=
). Assignment expressions allow a value to be assigned to a variable, even a variable that doesn’t exist yet, in the context of an expression rather than as a stand-alone statement.
while (line := file.readline()) != "end": print(chunk)