[Python-Dev] Status regarding Old vs. Advanced String Formating

Gregory P. Smith greg at krypto.org
Fri Feb 24 22:56:44 CET 2012

On Fri, Feb 24, 2012 at 1:52 PM, Tshepang Lekhonkhobe
<tshepang at gmail.com> wrote:
> On Fri, Feb 24, 2012 at 23:39, "Martin v. Löwis" <martin at v.loewis.de> wrote:
>>> It is a burden for some people to learn and remember the exact details
>>> of both systems and exactly how they differ. Having both in the stdlib
>>> hurts readability for such people. I would prefer that the stdlib only
>>> used {} formatting or if not that, that it only used the simple,
>>> hard-to-forget forms of % formatting (%s, %d, %f, without elaboration).
>> If that issue was getting serious, I would prefer if the .format method
>> was deprecated, and only % formatting was kept.
> Why is that? Isn't .format regarded superior? Or is this just a matter of taste?

It has superior features, but its current implementation is much
slower and there is a HUGE body of existing code that would need
conversion (a lot of that is automatable), including most uses of the
logging module.  % formatting is also familiar to anyone who uses C
and C++ on a regular basis.

as martin said, both will exist for a long time.


More information about the Python-Dev mailing list