From: Éric Araujo Date: Thu, 1 Sep 2011 16:59:06 +0000 (+0200) Subject: Document that format string don’t support arbitrary dictonary keys. X-Git-Tag: v3.2.3rc1~591^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=29cf58c9d56ee488ab12ae0110baa900f36f6ec6;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 2443180f315f..78f2b4ded36b 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -216,6 +216,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]'``