When and Why to Use :=
Over =
in Python
The Walrus Operator
Very recently, Python 3.8 introduced the use of ‘colon equals’ (:=
), which is similar to the equals operator (=
). The use of this operator allows for speedup and shortened code, and it’s definitely valuable to understand.
This notation comes from a complaint rooted in mathematics. When we write equations in mathematics, we may write…