[issue13598] string.Formatter doesn't support empty curly braces "{}"

Vinay Sajip report at bugs.python.org
Sun Jun 3 20:28:13 CEST 2012


Vinay Sajip <vinay_sajip at yahoo.co.uk> added the comment:

It seems like the patch doesn't consider mixing of positional and keyword arguments: if you have the format string "{foo} {} {bar}", then manual will be set to True when "foo" is seen as the field_name, and fail soon after when "" is seen as the field_name the next time around.

So, the test should include something which shows that

fmt.format("{foo} {} {bar}", 2, foo='fooval', bar='barval') returns "fooval 2 barval", whereas with a format string like "{foo} {0} {} {bar}" or "{foo} {} {0} {bar}" you get a ValueError.

Also, why "automatic field numbering" vs. "manual field specification"? Why not "numbering" for both?

----------
nosy: +vinay.sajip

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13598>
_______________________________________


More information about the Python-bugs-list mailing list