[Python-Dev] summary of transitioning from % to {} formatting (original) (raw)

Steven Bethard steven.bethard at gmail.com
Sat Oct 3 17:41:36 CEST 2009


I thought it might be useful for those who don't have time to read a million posts to have a summary of what's happened in the formatting discussion.

The basic problem is that many APIs in the standard library and elsewhere support only %-formatting and not {}-formatting, e.g. logging.Formatter accepts:: logging.Formatter(fmt="%(asctime)s - %(name)s") but not:: logging.Formatter(fmt="{asctime} - {name}")

There seems to be mostly agreement that these APIs should at least support both formatting styles, and a sizable group (including Guido) believe that %-formatting should eventually be phased out (e.g. by Python 4). There are a number of competing proposals on how to allow such APIs to start accepting {}-format strings:

I don't think there is consensus yet on which of these proposals should be the "blessed" one.

Steve

Where did you get that preposterous hypothesis? Did Steve tell you that? --- The Hiphopopotamus



More information about the Python-Dev mailing list