This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Autonumbering in string.Formatter doesn't work
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.3, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: binkert, eric.smith
Priority: normal Keywords:

Created on 2013-02-25 04:54 by binkert, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg182916 - (view) Author: Nathan Binkert (binkert) Date: 2013-02-25 04:54
Autonumbering with string.format does not work as it does in str.format:

>>> '{}'.format(1)
'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]
msg182927 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2013-02-25 09:12
This is a duplicate of issue 13598. I'll add you to nosy over there.
History
Date User Action Args
2022-04-11 14:57:42adminsetgithub: 61494
2013-02-25 09:12:28eric.smithsetstatus: open -> closed
resolution: duplicate
messages: + msg182927

stage: resolved
2013-02-25 05:09:52ned.deilysetnosy: + eric.smith
2013-02-25 04:54:47binkertcreate