[Python-ideas] String formatting and namedtuple

Lie Ryan lie.1296 at gmail.com
Wed Feb 18 03:20:07 CET 2009

On Tue, 17 Feb 2009 10:32:17 -0800, Guido van Rossum wrote:

> You can do similar things with .format(), but inside {} the : and !
> characters always end the key.

Why not keep something like str.old_format(formatcode, tuple_or_object) 
for py3k for backward compatibility purpose, then completely removing it 
on python 4.0? Add a note that .old_format is obsolete and would be 
removed and codes should use the newer formatters. That way 2to3 tool 
would become simpler (just convert most things to old_format). While for 
the most common use cases (e.g. 'old%sliteral' % item), it can 
automatically be converted it to 'new{}literal'.format(item) or $-

More information about the Python-ideas mailing list