Daily Software Tips & Tricks

Bite-sized knowledge to improve your coding skills daily.

Quick Debugging in Python with f-string Self-Documenting Expressions

May 28, 2026

If you still find yourself writing `print(f"user_id: {user_id}")` to debug your Python code, there's a much cleaner way. Since Python 3.8, you can add an equals sign `=` inside the curly braces of your f-string to print both the expression and its evaluated value.

Simply write `print(f"{user_id=}")` and Python will automatically output `user_id='12345'`. It works for expressions and function calls too, saving you a ton of keystrokes during quick debugging sessions.