From a0f1bc95313f1d9483f9b49624158f8c10f31bf5 Mon Sep 17 00:00:00 2001 From: achhina Date: Tue, 6 Jun 2023 22:01:36 -0400 Subject: [PATCH] GH-95088: Clarify rules for parsing an item key for format strings (GH-103779) (cherry picked from commit 3e7316d7e8969febb56fbc7416d483b073bd1702) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: achhina Co-authored-by: Ɓukasz Langa Co-authored-by: Jelle Zijlstra --- Doc/library/string.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 26b3f5000634f5..9b28f99536a3ae 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -227,7 +227,9 @@ See also the :ref:`formatspec` section. The *field_name* itself begins with an *arg_name* that is either a number or a keyword. If it's a number, it refers to a positional argument, and if it's a keyword, -it refers to a named keyword argument. If the numerical arg_names in a format string +it refers to a named keyword argument. An *arg_name* is treated as a number if +a call to :meth:`str.isdecimal` on the string would return true. +If the numerical arg_names in a format string are 0, 1, 2, ... in sequence, they can all be omitted (not just some) and the numbers 0, 1, 2, ... will be automatically inserted in that order. Because *arg_name* is not quote-delimited, it is not possible to specify arbitrary