4 ms·
this has nothing to do with the walrus operator and everything to do with how string.format works in python https://docs.python.org/3/library/string.html#format
by almostgotcaught 1y ago
this has nothing to do with the walrus operator and everything to do with how string.format works in python https://docs.python.org/3/library/string.html#format-string-syntax https://docs.python.org/3/library/string.html#format-string-...
Edit: someone downvoted me because they don't understand there is no walrus operator here
print(f"{a:=10}")
- lyu07282 1y agoThey obviously meant the second example: >>> print(f"{(a:=10)}")
- almostgotcaught 1y agothe output of the second example is "obvious" so i don't see the problem.
- pansa2 1y agoNeither of the examples is problematic on its own; it's the fact that the language supports both of them. They're very hard to distinguish at-a-glance yet behave entirely differently.