10000 [3.12] GH-95088: Clarify rules for parsing an item key for format str… · python/cpython@ca4649a · GitHub
[go: up one dir, main page]

Skip to content

Commit ca4649a

Browse files
miss-islingtonachhinaambvJelleZijlstra
authored
[3.12] GH-95088: Clarify rules for parsing an item key for format strings (GH-103779) (#105419)
GH-95088: Clarify rules for parsing an item key for format strings (GH-103779) (cherry picked from commit 3e7316d) Co-authored-by: achhina <amanschhina@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
1 parent f4969eb commit ca4649a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Doc/library/string.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ See also the :ref:`formatspec` section.
227227

228228
The *field_name* itself begins with an *arg_name* that is either a number or a
229229
keyword. If it's a number, it refers to a positional argument, and if it's a keyword,
230-
it refers to a named keyword argument. If the numerical arg_names in a format string
230+
it refers to a named keyword argument. An *arg_name* is treated as a number if
231+
a call to :meth:`str.isdecimal` on the string would return true.
232+
If the numerical arg_names in a format string
231233
are 0, 1, 2, ... in sequence, they can all be omitted (not just some)
232234
and the numbers 0, 1, 2, ... will be automatically inserted in that order.
233235
Because *arg_name* is not quote-delimited, it is not possible to specify arbitrary

0 commit comments

Comments
 (0)
0