summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-06-07 03:56:03 (GMT)
committerGitHub <noreply@github.com>2023-06-07 03:56:03 (GMT)
commit5e4c46f02951b979854121adc4b628e57467ac95 (patch)
tree0359842d0f561c4e1bbe7920365f0150d84e7a5e
parent24561363606531b91ca689ff2110a529d8272f6b (diff)
downloadcpython-5e4c46f02951b979854121adc4b628e57467ac95.zip
cpython-5e4c46f02951b979854121adc4b628e57467ac95.tar.gz
cpython-5e4c46f02951b979854121adc4b628e57467ac95.tar.bz2
[3.11] GH-95088: Clarify rules for parsing an item key for format strings (GH-103779) (#105418)
GH-95088: Clarify rules for parsing an item key for format strings (GH-103779) (cherry picked from commit 3e7316d7e8969febb56fbc7416d483b073bd1702) Co-authored-by: achhina <amanschhina@gmail.com> Co-authored-by: Ɓukasz Langa <lukasz@langa.pl> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
-rw-r--r--Doc/library/string.rst4
1 files changed, 3 insertions, 1 deletions
diff --git a/Doc/library/string.rst b/Doc/library/string.rst
index 5ada827..b2ea9c1 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