[Python-ideas] String formatting and namedtuple

Terry Reedy tjreedy at udel.edu
Fri Feb 13 05:37:44 CET 2009

Steven D'Aprano wrote:
> Terry Reedy wrote:
>> PROPOSAL: Allow the simple case to stay simple.  Allow field names to 
>> be omitted for all fields in a string and then default to 0, 1, ... so 
>> that example above could be written as
>>  >>> msg = "{} == {}".format
>> Given that computers are glorified counting machines, it *is* a bit 
>> annoying to be required to do the counting manually.  I think this is 
>> at least half the objection to switching to .format.
> +1 from me. Just to make it explicit: omitting field names will be an 
> all-or-nothing proposition: you can't omit some of them unless you omit 
> them all. Correct?

That is my proposal.  I should have made that clearer, as I now did on 
the tracker issue I filed.  My idea was that the function could switch 
from current behavior to alternative behavior depending on the presence 
or absence of anything in the first {}.  But that is up to the patch writer.


More information about the Python-ideas mailing list