Skip to content

Commit 1015809

Browse files
committed
gh-150626: Update Format String Syntax documentation
1 parent a8d74c0 commit 1015809

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Doc/library/string.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,11 @@ The grammar for a replacement field is as follows:
219219
.. productionlist:: format-string
220220
replacement_field: "{" [`field_name`] ["!" `conversion`] [":" `format_spec`] "}"
221221
field_name: `arg_name` ("." `attribute_name` | "[" `element_index` "]")*
222-
arg_name: [`~python-grammar:identifier` | `~python-grammar:digit`+]
223-
attribute_name: `~python-grammar:identifier`
224-
element_index: `~python-grammar:digit`+ | `index_string`
222+
arg_name: [`decimal_number` | `attribute_name`]
223+
attribute_name: <any source character except "{", "}", "[", ".", "!", or ":"> +
224+
element_index: `decimal_number` | `index_string`
225225
index_string: <any source character except "]"> +
226+
decimal_number: <a string of one or more Unicode decimal digit characters>
226227
conversion: "r" | "s" | "a"
227228
format_spec: `format-spec:format_spec`
228229

0 commit comments

Comments
 (0)