The Operator That Dethroned a King: Python's Walrus Operator Story
https://techlife.blog/posts/the-operator-that-dethroned-a-king-pythons-walrus-operator-story/
#Python #PEP572 #WalrusOperator #GuidoVanRossum #opensourceprogramming
The Operator That Dethroned a King: Python's Walrus Operator Story
https://techlife.blog/posts/the-operator-that-dethroned-a-king-pythons-walrus-operator-story/
#Python #PEP572 #WalrusOperator #GuidoVanRossum #opensourceprogramming
Null Coalescing vs Walrus Operator: One-Line Power
PHP's ?? operator vs Python's := walrus operator. Which language gives you more one-line superpowers? Mind = blown!
#php #python #phpvspython #nullcoalescing #walrusoperator #operators #oneliner #programmingcomparison #phptricks #pythontricks #codecomparison #syntaxcomparison #viralcoding

Nullish Coalescing vs Walrus Operator: Modern Operator Face-Off
JavaScript ?? operator vs Python := walrus operator. Which language's modern operator is more useful? This comparison is INSANE!
#javascript #python #javascriptvspython #nullishcoalescing #walrusoperator #modernoperators #programmingcomparison #codecomparison #javascripttricks #pythontricks #syntaxcomparison #viralcoding #codingshorts #es2020 #python3.8

Encapsulating the atrocity of umask handling with Python's walrus operator:
os.umask(current_umask := os.umask(0))
This isn't clearly *better*, but at least it's clearly shorter. Without `:=`, we'd need two lines:
current_umask = os.umask(0)
os.umask(current_umask)
Note: The awkwardness is a necessary consequence of how POSIX handles umask. Also, neither version is threadsafe.
would you use the #WalrusOperator?
if test_fit(i, j, s) or test_fit(i, j, s := 1):
fill_grid(i, j, s)
or make it a bit longer like this
if test_fit(i, j, s):
fill_grid(i, j, s)
elif test_fit(i, j, 1):
fill_grid(i, j, 1)
? #Python
one thing I would love for python is to be able to say
if not s := some_query(args):
stuff if the query fails
else:
stuff if the query succeeds and you have s assigned