Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 29cf58c

Browse files
committed
Document that format string don’t support arbitrary dictonary keys.
Text adapted from the PEP. Addition requested by Terry J. Reedy on 2011-02-23 on python-dev.
1 parent 8ab3a1d commit 29cf58c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Doc/library/string.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ keyword. If it's a number, it refers to a positional argument, and if it's a ke
216216
it refers to a named keyword argument. If the numerical arg_names in a format string
217217
are 0, 1, 2, ... in sequence, they can all be omitted (not just some)
218218
and the numbers 0, 1, 2, ... will be automatically inserted in that order.
219+
Because *arg_name* is not quote-delimited, it is not possible to specify arbitrary
220+
dictionary keys (e.g., the strings ``'10'`` or ``':-]'``) within a format string.
219221
The *arg_name* can be followed by any number of index or
220222
attribute expressions. An expression of the form ``'.name'`` selects the named
221223
attribute using :func:`getattr`, while an expression of the form ``'[index]'``

0 commit comments

Comments
 (0)