I'm maintaining an old Python codebase that has some very strange idioms scattered throughout it. One thing I've come across is string formatting using the percent-encoded style:
'Error %s: %s' % (str(err), str(message))
Ignoring the existence of .format()
for modern string interpolation, the question I have is:
Is it necessary to explicitly convert %s
parameters with str()
or is that exactly what %s
does?