[Python-Dev] converting the stdlib to str.format

Antoine Pitrou solipsis at pitrou.net
Thu Jun 5 16:49:35 CEST 2008


Nick Coghlan <ncoghlan <at> gmail.com> writes:
> 
> %r is about the worst case for the new syntax relative to the old - two 
> characters become 5.

Well there are other very common "worst cases" - namely %d, %f (and probably
a few less commonly used ones such as %X).

> For dictionary formatting, str.format() is a clear winner over 
> str.__mod__().

Agreed. %(something)s is quirky - you are bound to forget the final "s"
(or whatever other specifier) from time to time.

Antoine.





More information about the Python-Dev mailing list