.format() is mostly too verbose for my tastes. Even Guido himself put it into the "meh" category in a talk. To be clear, I do use it when I need quick lightweight templating, say building a very complicated string.
But for most simple output printf style is shorter, simpler and I know it by heart. There was a guy at work who insisted on using .format() for everything that soured me on it, sometimes even simple string concatenation:
print 'result: {long_var_name}'.format({long_var_name=long_var_name})
Sometimes lines reached 200 chars. If lines were broken down, they might extend to 4 lines for each debug statement, adding tons of clutter. Said it was more readable because you could ignore the end. :/As sago said, printf is more concise in the majority of use cases. Not to mention the logging niceties:
log.info('result: %s %s', one, two) # shorter and note that fmt is deferred!
A _big_ one in my eyes. Too bad logging doesn't support {} internally.I've also wondered if .format could be improved if the % operator could be used with it, given appropriate precedence rules. Or perhaps use another char... dunno & or /?
print 'results: {} {}' % results
print 'results: {} {}' %% results
print 'results: {} {}' / results
Pycon, are you listening? ;)