[New-bugs-announce] [issue17292] Autonumbering in string.Formatter doesn't work

Nathan Binkert report at bugs.python.org
Mon Feb 25 05:54:47 CET 2013

New submission from Nathan Binkert:

Autonumbering with string.format does not work as it does in str.format:

>>> '{}'.format(1)
>>> import string
>>> string.Formatter().format('{}', 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/nate/src/python3/Lib/string.py", line 164, in format
    return self.vformat(format_string, args, kwargs)
  File "/Users/nate/src/python3/Lib/string.py", line 168, in vformat
    result = self._vformat(format_string, args, kwargs, used_args, 2)
  File "/Users/nate/src/python3/Lib/string.py", line 190, in _vformat
    obj, arg_used = self.get_field(field_name, args, kwargs)
  File "/Users/nate/src/python3/Lib/string.py", line 253, in get_field
    obj = self.get_value(first, args, kwargs)
  File "/Users/nate/src/python3/Lib/string.py", line 210, in get_value
    return kwargs[key]

components: Library (Lib)
messages: 182916
nosy: binkert
priority: normal
severity: normal
status: open
title: Autonumbering in string.Formatter doesn't work
versions: Python 2.7, Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list