[Python-Dev] converting the stdlib to str.format

Nick Coghlan ncoghlan at gmail.com
Wed Jun 4 12:23:08 CEST 2008


Martin v. Löwis wrote:
>>> Please don't - not before % is actually deprecated (which I hope won't
>>> happen until Python 4, with removal of % in Python 5, in the year
>>> when I retire, i.e. 2037).
>> Now this is news to me -- was there a discussion that changed the
>> lifetime expectancy of str.__mod__? I'd always supposed it being
>> deprecated at some point in 3.x.
> 
> The PEP doesn't specify anything, and I don't recall any discussion,
> either - the specific timing suggested above is merely my own hopes.

While str.format has an awful lot of points in its favour (no tuple/dict 
special casing, much cleaner handling of named arguments, access to 
format options for non-builtin types), there are some debugging cases 
where I suspect the basic version of % formatting will prove to be more 
convenient.

At this point in time, my personal preference would be that later in the 
3.x series certain aspects of % formatting will be deprecated 
(acceptance of non-tuples in favour of the format() builtin, acceptance 
of dicts in favour of str.format), but that simple % formatting of a 
tuple of values will still be permitted.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list