New-style string formatting

Kim Petersen kp at kyborg.dk
Tue May 20 19:11:32 EDT 2003


Skip Montanaro wrote:
> 
>     * does it significantly increase of expressive power or clarity of the
>       language?  No matter that you like "..."(args) better than
>       "..."%(args), the former is is clearly not head and shoulders better
>       than the latter in this respect. [2]
> 
> In some sense you have two strikes against you.  I don't see "..."(args)
> clearing either the second or third barriers.

actually that one  is not against - it certainly removes a _very_ common 
mistake - namely: "some string: %s" % tuple - and makes it very clear 
that you should either write: "some string: %s"(tuple) or "some string: 
%s"(*tuple) - and neither would give breakage - whereas current breaks 
in case of len(tuple) is 1.

not that i'm for this change, mind you ;-)

> 
> Skip
> 
> [1] That's like me not being able to use my Camel book (Perl v4) to learn
> how to use Perl's references (new in Perl v5).  My Camel book is thus
> generally worthless to me because it doesn't help me make my Perl code look
> like Python. ;-)
> 
> [2] Aside: Would "..."(args) be more efficient than "..."%(args)?
> 

-- 
Med Venlig Hilsen / Regards

Kim Petersen - Kyborg A/S (Udvikling)
IT - Innovationshuset
Havneparken 2
7100 Vejle
Tlf. +4576408183 || Fax. +4576408188





More information about the Python-list mailing list