[Python-ideas] One way to do format and print

Andrew Barnert abarnert at yahoo.com
Wed Sep 9 02:09:41 CEST 2015


On Sep 8, 2015, at 12:39, random832 at fastmail.us wrote:
> 
>> On Tue, Sep 8, 2015, at 14:39, Sven R. Kunze wrote:
>> Is it an issue when I think the % should be left behind? Just my 
>> personal preference.
>> 
>> It only increases the learning curve with no actual benefits.
> 
> My take is: Having two format string grammars is worse than having one,
> even if the %-grammar is worse than the {}-grammar.

I think it's already been established why % formatting is not going away any time soon.

As for de-emphasizing it, I think that's already done pretty well in the current docs. The tutorial has a nice long introduction to str.format, a one-paragraph section on "old string formatting" with a single %5.3f example, and a one-sentence mention of Template. The stdtypes chapter in the library reference explains the difference between the two in a way that makes format sound more attractive for novices, and then has details on each one as appropriate. What else should be done?


More information about the Python-ideas mailing list