MLearning.ai
Published in

MLearning.ai

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…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store