[Python-Dev] converting the stdlib to str.format (original) (raw)

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


Nick Coghlan <ncoghlan 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