Daily Software Tips & Tricks

Bite-sized knowledge to improve your coding skills daily.

Supercharge Your Python Debugging with f-String Self-Documenting Expressions

May 24, 2026

We've all written quick print statements like `print(f'user_id: {user_id}')` to debug our code. Python 3.8 introduced a brilliant shorthand that makes this much faster: just add an equals sign `=` inside the curly braces.

Writing `print(f'{user_id=}')` will automatically output both the variable name and its value, formatted as `user_id=123`. It even preserves whitespace and works with expressions, like `f'{user.get_name()=}'`. It's a tiny syntax trick that saves thousands of keystrokes over a project's lifetime.