News for hackers. Stuff that matters.
Re:Fstrings.wtf by almostgotcaught on Saturday July 19, 2025 @11:48AM (#44616509)
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-...
Re:Fstrings.wtf by lyu07282 on Saturday July 19, 2025 @01:18PM (#44617365)
They obviously meant the second example:

     >>> print(f"{(a:=10)}")
Re:Fstrings.wtf by almostgotcaught on Saturday July 19, 2025 @01:22PM (#44617395)
the output of the second example is "obvious" so i don't see the problem.
Re:Fstrings.wtf by pansa2 on Saturday July 19, 2025 @11:42PM (#44621793)
Neither 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.