mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
GH-95088: Clarify rules for parsing an item key for format strings (#103779)
Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
parent
9a89f1bf1e
commit
3e7316d7e8
1 changed files with 3 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue