[Python-Dev] Status regarding Old vs. Advanced String Formating
Terry Reedy
tjreedy at udel.edu
Fri Feb 24 20:52:09 CET 2012
On 2/24/2012 11:41 AM, Benjamin Peterson wrote:
> 2012/2/24 Tshepang Lekhonkhobe<tshepang at gmail.com>:
>> Hi,
>>
>> I was of the thought that Old String Formatting |"%s" % foo| was to be
>> phased out by Advanced String Formatting |"{}.format(foo)|. I however
>> keep seeing new code committed into the main VCS using the old style.
>> Is this okay? Is there a policy? I ask also because I expect CPython
>> to lead by example.
>
> Using either is fine I think. It doesn't hurt anyone to have old
> string formatting around for a long time.
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).
--
Terry Jan Reedy
More information about the Python-Dev
mailing list