diff options
author | Éric Araujo <merwok@netwok.org> | 2011-09-01 17:57:01 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-09-01 17:57:01 (GMT) |
commit | cd90f791252346741a2f0e374ef6afc7529cd4e6 (patch) | |
tree | 5f88012148989e80e4c2971a05eb0866b2c2b8d6 /Doc | |
parent | 2c378ae364df3d8cf263db022b9c6a92a0f6ccb1 (diff) | |
download | cpython-cd90f791252346741a2f0e374ef6afc7529cd4e6.zip cpython-cd90f791252346741a2f0e374ef6afc7529cd4e6.tar.gz cpython-cd90f791252346741a2f0e374ef6afc7529cd4e6.tar.bz2 |
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.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/string.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 9ee81b5..20fcae9 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -248,6 +248,8 @@ keyword. If it's a number, it refers to a positional argument, and if it's a ke it refers to a named keyword argument. 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 +dictionary keys (e.g., the strings ``'10'`` or ``':-]'``) within a format string. The *arg_name* can be followed by any number of index or attribute expressions. An expression of the form ``'.name'`` selects the named attribute using :func:`getattr`, while an expression of the form ``'[index]'`` |