[Python-ideas] String formatting and namedtuple

Aahz aahz at pythoncraft.com
Sun Feb 22 01:03:56 CET 2009


On Thu, Feb 12, 2009, Talin wrote:
>
> Secondly, there is an argument to be made towards moving away from any  
> syntactical pattern that requires the programmer to synchronize two  
> lists, in this case the set of '%' field markers in the string and the  
> sequence of replacement values. Having to maintain a correspondence  
> between lists is almost never a problem when code is first written, but  
> I think we can all remember instances where bugs have been introduced by  
> maintainers who added a new item to one list but forgot to add the  
> corresponding item to the other list.

This is still problematic with {#} syntax when lists are re-ordered,
which creates a more difficult editing job.  Moreover, precisely because
{#} syntax doesn't blow up in the face of adding elements, it creates
more silent bugs IMO.  Altogether, although you have a point I think it
ends up being the same total pain, just shifted around.
-- 
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