From d86ac4cd4e77fc3646b72f2eeb2aa5df83361f01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Thu, 1 Sep 2011 18:59:06 +0200 Subject: =?UTF-8?q?Document=20that=20format=20string=20don=E2=80=99t=20sup?= =?UTF-8?q?port=20arbitrary=20dictonary=20keys.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Text adapted from the PEP. Addition requested by Terry J. Reedy on 2011-02-23 on python-dev. --- Doc/library/string.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 3f9ec0b..a367ca8 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -217,6 +217,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]'`` -- cgit v0.12