Re:Icecream: Never use print() to debug again in Python
by OJFord on Tuesday March 30, 2021 @06:55AM
(#26633130)
>>> print(f"{(yes:='yes')=}")
(yes:='yes')='yes'
Re:Icecream: Never use print() to debug again in Python
by mkl on Tuesday March 30, 2021 @08:03AM
(#26633598)
Yep.
>>> print(f"{(yes:='yes') = } and now {yes = }")
(yes:='yes') = 'yes' and now yes = 'yes'
Re:Icecream: Never use print() to debug again in Python
by wadkar on Tuesday March 30, 2021 @08:25AM
(#26633774)
I believe the walrus operator `:=` was introduced in Python 3.8. So keep that it in mind.
Also assignment expressions? :)