[Python-3000] string.Formatter class

Eric Smith eric+python-dev at trueblade.com
Wed Aug 29 05:33:10 CEST 2007


Eric Smith wrote:
> Jim Jewett wrote:

>> but you might want to take inspiration from the "tail" of an
>> elementtree node, and return the field with the literal next to it as
>> a single object.
>>
>>     (literal_text, field_name, format_spec, conversion)
> 
> I think I like that best.

I implemented this in r57641.  I think it simplifies things.  At least,
it's easier to explain.

Due to an optimization dealing with escaped braces, it's possible for
(literal, None, None, None) to be returned more than once.  I don't
think that's a problem, as long as it's documented.  If you look at
string.py's Formatter.vformat, I don't think it complicates the
implementation at all.

Thanks for the suggestion.





More information about the Python-3000 mailing list