I'm probably missing something here, after searching I couldn't find an answer.I've explored quite a few Python projects and one thing I keep noticing is the fact that the majority of them continue to use the % operator for formatting strings rather than the newer, recommended .format() method. Is there a reason for this? it seems like a trivial change, unless I'm missing something entirely.For example:# count how many times the % operator technique is usedfind . -name *.py -exec grep -HE \[^\]+\\s\%\s\w+|'[^']+'\s\%\s\w+ {} \; | wc -l# and the same for format()find . -name *.py -exec grep -HE \w+\.format\( {} \; | wc -l# Results:##               % operator        format()# iPython          670               63# Django           977               8# Tornado          91                0# requests         25                1No real reason for this question, just curious.Cheers guys!
Why isn't the format method more widely used in Python?
python
Three extremely strong inclinations come together to produce this effect:Comfort: I know how to do this the old way, learning the new way would be more effort.effort/effect trade-off: Is the old method gone? Is it even deprecated? No? Then there is no business case whatsoever for changing this. Create new code instead.Safety: Are you sure the proposed new way of doing things is exactly equivalent? No? Then better leave the old code as it is - you might introduce defects.All three are, in fact, quite sensible (the first one least so, since continual learning is what information workers should thrive on).(Edit: As pointed out below there is a fourth point: not knowing that the new method even exists! This is less sensible, but might actually be the most common one.)