[Python-ideas] String formatting and namedtuple

Aahz aahz at pythoncraft.com
Thu Feb 12 20:45:21 CET 2009


On Thu, Feb 12, 2009, 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 -- given this, I would remove half my objection to .format(); the rest
has mostly to do with backward compatibility as explained previously.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.



More information about the Python-ideas mailing list