With the latest Python 3.6, we have a new nice way to format strings, the f-strings: f'Hello {name}'
.
Let's assume we are starting a project supporting only Python >3.6, should we totally abandon the good old %-formatting ('Hello %s' % name
), which has several limitations compared to f-strings and is less elegant?
We also could imagine that the %-formatting may be deprecated in the future.
In "f-strings in Python 3.6" question, the .format()
case is discussed, but we could have the same discussion about %-formatting
.
I couldn't find any recommendation in the documentation, nor in PEP 498 which introduced f-strings.
Some thoughts about this?