Use the Walrus Operator to Assign and Print in One Line

My new favorite use of the walrus operator in Python

Jonathan Hsu
Better Programming
Published in
2 min readNov 18, 2019

--

Photo by Mr Cup / Fabien Barral on Unsplash

In Python 3.8, the assignment-expression operator, walrus operator, was released. The convention has been met with a mixed reception as some claim the syntax goes against the “simple is better” vision of Python.

--

--