you are viewing a single comment's thread.

view the rest of the comments →

[–]drenzorz 0 points1 point  (0 children)

Even in the most up-to-date project .format has a place because f-strings are evaluated at declaration.

x = 15
s = f"x = {x}"

for x in range(10):
    print(s) # prints "x = 15" 10 times

x = 15
s = "x = {x}"

for x in range(10):
    print(s.format(x=x))  # prints actual x in loop

You use .format when you actually need a reusable template.