Towards the Gestalt
BlogTILProjectsAbout
Published on
March 10, 2025

TIL: Python's debug f-string `{var =}` is whitespace-sensitive

The debugging feature in Python's f-strings, like {my_variable =}, is sensitive to whitespace. The spaces around the variable name matter.

a = 10
b = 20
print(f'{a=}')  # prints "a=10"
print(f'{b =}')  # prints "b =20"
print(f'{a + b = }')  # prints "a + b = 30"

Source: Noticed in a PyTorch tutorial - How to use CutMix and MixUp.

← Barriers vs. Fences in concurrent programming
The origin of the name "Tron" →
mailMailgithubGitHublinkedinLinkedinblueskyBluesky
Krut Patel
•
© 2025
•
Krut's Blog
Tailwind Nextjs Theme