f-string is easier to read, write, and less computationally expensive than legacy string formatting.
f-strings provide a way to embed expressions inside string literals using minimal syntax. Through this f-strings are readable, more concise, and less prone to error than other ways of formatting.
Legacy string formatting such as printf style and
.format(...) are less readable than f-strings. Given that these are completely equivalent:
Why not choose the easiest to read, write, and quickest to execute (the first one)?
If our GitHub code review bot spots this issue in your pull request it gives this advice:
Code Review Doctor will run this check by default. No configuration is needed but the check can be turned on/off using check code
use-f-string in your pyproject.toml file.