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: No update about automatic numbering of fields in format strings (e.g. 'A {} with {} buttocks')
Type: Stage:
Components: Documentation Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: eric.smith Nosy List: eric.smith, georg.brandl, zuo
Priority: low Keywords:

Created on 2009-07-26 14:11 by zuo, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg90946 - (view) Author: Jan Kaliszewski (zuo) Date: 2009-07-26 14:11
As we can read in http://docs.python.org/3.1/whatsnew/3.1.html#other-
language-changes:

----
The fields in format() strings can now be automatically numbered:
>>> 'Sir {} of {}'.format('Gallahad', 'Camelot')
'Sir Gallahad of Camelot'

Formerly, the string would have required numbered fields such as: 'Sir 
{0} of {1}'.

(Contributed by Eric Smith; issue 5237.)
----

But it is not mentioned in 3.2's, 3.1's and 2.7's docs about format 
string syntax, e.g. in 3.1 docs we have:

http://docs.python.org/3.1/library/string.html#format-string-syntax

[Please note that also grammar for a replacement field should be 
updated there ('field_name' should be in '[' ']', but I'm not sure if 
it'd be enough)].
msg90951 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-07-26 14:25
(Sorry for my confusion, reopening.)
msg91121 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2009-07-31 02:31
In http://docs.python.org/3.1/library/string.html#format-string-syntax,
the auto-numbering is mentioned, in the sentence that starts "If the
numerical arg_names in a format string are 0, 1, 2, ... in sequence,
they can all be omitted".

It's true that the field_name should be optional. I'll look at fixing that.
msg92189 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2009-09-02 21:57
This is a duplicate of issue 6813, where it has been fixed. I'm closing it.
History
Date User Action Args
2022-04-11 14:56:51adminsetgithub: 50828
2009-09-02 21:57:55eric.smithsetstatus: open -> closed
resolution: duplicate
messages: + msg92189
2009-07-31 02:31:51eric.smithsetpriority: low

messages: + msg91121
2009-07-26 14:25:47georg.brandlsetstatus: closed -> open

nosy: + eric.smith
messages: + msg90951

assignee: georg.brandl -> eric.smith
resolution: works for me -> (no value)
2009-07-26 14:25:03georg.brandlsetmessages: - msg90948
2009-07-26 14:24:46georg.brandlsetmessages: - msg90949
2009-07-26 14:24:37georg.brandlsetmessages: + msg90949
2009-07-26 14:22:04georg.brandlsetstatus: open -> closed
resolution: works for me
messages: + msg90948
2009-07-26 14:11:08zuocreate