Skip to content

Commit ce915de

Browse files
committed
Update "Format String Syntax" documentation block to match actual behaviour
From discussion thread: https://discuss.python.org/t/format-string-syntax-specification-differs-from-actual-behaviour/46716/2
1 parent e7c5f60 commit ce915de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Doc/library/string.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ The grammar for a replacement field is as follows:
216216
.. productionlist:: format-string
217217
replacement_field: "{" [`field_name`] ["!" `conversion`] [":" `format_spec`] "}"
218218
field_name: `arg_name` ("." `attribute_name` | "[" `element_index` "]")*
219-
arg_name: [`~python-grammar:identifier` | `~python-grammar:digit`+]
220-
attribute_name: `~python-grammar:identifier`
219+
arg_name: [`~python-grammar:digit`+ | `attribute_name`]
220+
attribute_name: <any source character except "{", "}", "[", or "."> +
221221
element_index: `~python-grammar:digit`+ | `index_string`
222222
index_string: <any source character except "]"> +
223223
conversion: "r" | "s" | "a"

0 commit comments

Comments
 (0)