[Python-Dev] transitioning from % to {} formatting

Nick Coghlan ncoghlan at gmail.com
Sat Oct 3 07:24:41 CEST 2009

Raymond Hettinger wrote:
> Because there has been limited uptake on {}-formatting (afaict),
> we still have limited experience with knowing that it is actually
> better, less error-prone, easier to learn/rember, etc.   Outside
> a handful of people on this list, I have yet to see anyone adopt
> it as the preferred syntax.

A self-fulfilling prophecy if ever I heard one... uptake is limited
because there's a large legacy code base that doesn't use it and many
APIs don't support it, so we shouldn't bother trying to increase the
number of APIs that *do* support it?

I'm starting to think that a converter between the two format
mini-languages may be the way to go though.

fmt_braces is meant to provide a superset of the capabilites of
fmt_percent, so a forward converter shouldn't be too hard. A reverse
converter may have to punt with ValueError when it finds things that
cannot be expressed in the fmt_percent mini language though.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-Dev mailing list