[Python-checkins] cpython (3.2): Document that format string don’t support arbitrary dictonary keys.

georg.brandl python-checkins at python.org
Sun Sep 4 08:42:37 CEST 2011


http://hg.python.org/cpython/rev/2c27eb4033f5
changeset:   72248:2c27eb4033f5
branch:      3.2
user:        Éric Araujo <merwok at netwok.org>
date:        Thu Sep 01 18:59:06 2011 +0200
summary:
  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.

files:
  Doc/library/string.rst |  2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/Doc/library/string.rst b/Doc/library/string.rst
--- a/Doc/library/string.rst
+++ b/Doc/library/string.rst
@@ -217,6 +217,8 @@
 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]'``

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list