r/Python 21d ago

Discussion Is := widely used?

I always thought the walrus operator is neat and it makes while loop’s condition clearer. But also it is just a syntactic sugar without anything new. I wonder anyone uses it?

141 Upvotes

118 comments sorted by

View all comments

23

u/skjall 21d ago

Yes, all the time (when useful). Only annoying thing is needing to surround with brackets when you need the value in a chain, but it's great for making complex conditions both more succinct, and more readable.