Myth Busters: % "this old style of formatting will eventually be removed from the language"

Denis McMahon denismfmcmahon at gmail.com
Wed May 22 10:24:03 EDT 2013


On Tue, 21 May 2013 23:26:58 -0400, Ned Batchelder wrote:

> On 5/21/2013 10:26 PM, Carlos Nepomuceno wrote:

>> "Since str.format() is quite new, a lot of Python code still uses the %
>> operator. However, because this old style of formatting will eventually
>> be removed from the language, str.format() should generally be used."

>> Is this tutorial outdated or this still an issue?

> That tutorial is out of date.  %-formatting isn't being removed.

Indeed, removing %-formatting could break a substantial amount of live 
code, with potentially significant maintenance effort in the user 
community simply to make existing code work with the new interpreter. The 
effect of this on corporations using python code translates into 
"business risk", and the next step is "we can avoid the business risk by 
migrating our python scripts to some other language."

For the designers and maintainers of any language to arbitrarily[1] (in 
the eyes of the user base) remove a widely used feature that would have a 
major effect on the user base could kill off a language, simply because 
many users will not want to take the risk of it happening again, even if 
they can easily automate the upgrade from removed obsolete language 
feature to new shiny language feature.

[1] Some portion of the user base will always consider any such change 
that causes them headaches and additional effort as having been 
arbitrary, no matter how well the language designers and maintainers 
explain the need to break the old scripts.

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list