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

Nick Coghlan ncoghlan at gmail.com
Fri Feb 24 18:09:48 CET 2012


On Sat, Feb 25, 2012 at 2:41 AM, Benjamin Peterson <benjamin at python.org> 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. In general, +0 for using new
> string formatting.

Yep. Also, the two can work nicely in tandem as templates for each
other that don't need tons of escaping.

>>
>> On another note, will the old format ever be deprecated? Is there a date?
>
> I doubt it.

*If* the old format were ever to be deprecated (and that's a very big
if), Python 4k would be the earliest it could happen. More likely the
old format will just hang around indefinitely, though.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list