.format vs. %

Ethan Furman ethan at stoneleaf.us
Tue Jan 3 08:26:57 EST 2012


Ian Kelly wrote:
> I'm not sure it's true that "there are no plans to do so in the
> foreseeable future."  According to the release notes from Python 3.0,
> % formatting was supposed to be deprecated in Python 3.1.

Eric Smith wrote (from a thread on pydev in 02-2011):
 > The last thread on this I have a reference to was in September 2009. I
 > think was basically the outcome:
 > http://mail.python.org/pipermail/python-dev/2009-September/092399.html
 >
 > So there will be no deprecation, just a gradual shift to PEP 3101
 > formatting.

Ian Kelly wrote:
> Maybe there was a discussion on py-dev
> where it was decided that % formatting would not be deprecated after
> all (in which case the misleading "obsolete" note really ought to be
> removed from the documentation).  

Agreed that this is a documentation bug.

Ian Kelly wrote:
> The reason for deprecating it is because Python currently has no fewer
> than three mechanisms for string formatting (not even including
> ordinary string concatenation), which according to the Zen of Python
> is two too many.

"one obvious way" != "only one way"

~Ethan~



More information about the Python-list mailing list