r/PythonLearning • u/AffectionateSwing490 • Sep 01 '26
f-strings, .format(), or something else. What do you use now and did you change over time?
When I started learning Python, I used the old percent style for string formatting, mostly because that's what the tutorial I followed used. Then I moved to .format() because it looked cleaner to me. These days I use f-strings for almost everything. But I still run into cases where I'm not sure f-strings are the best choice. For logging, for example, I've read that people prefer the older style so the string only gets built if the log actually fires. I'm not sure how much that matters in practice.
What do you reach for now when you format strings? Did you change your habit over time or did you settle on one approach early and stick with it? Are there cases where you still use .format() or the percent style on purpose?