[Python-checkins] cpython (2.7): #19238, #19289: fix description of the align and fill values of the format

ezio.melotti python-checkins at python.org
Mon Oct 21 01:54:17 CEST 2013


http://hg.python.org/cpython/rev/0592dc076bb7
changeset:   86528:0592dc076bb7
branch:      2.7
parent:      86510:44ac81e6d584
user:        Ezio Melotti <ezio.melotti at gmail.com>
date:        Mon Oct 21 02:53:07 2013 +0300
summary:
  #19238, #19289: fix description of the align and fill values of the format specification.

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


diff --git a/Doc/library/string.rst b/Doc/library/string.rst
--- a/Doc/library/string.rst
+++ b/Doc/library/string.rst
@@ -323,18 +323,18 @@
 
 .. productionlist:: sf
    format_spec: [[`fill`]`align`][`sign`][#][0][`width`][,][.`precision`][`type`]
-   fill: <a character other than '{' or '}'>
+   fill: <any character>
    align: "<" | ">" | "=" | "^"
    sign: "+" | "-" | " "
    width: `integer`
    precision: `integer`
    type: "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"
 
-The *fill* character can be any character other than '{' or '}'.  The presence
-of a fill character is signaled by the character following it, which must be
-one of the alignment options.  If the second character of *format_spec* is not
-a valid alignment option, then it is assumed that both the fill character and
-the alignment option are absent.
+If a valid *align* value is specified, it can be preceeded by a *fill*
+character that can be any character and defaults to a space if omitted.
+Note that it is not possible to use ``{`` and ``}`` as *fill* char while
+using the :meth:`str.format` method; this limitation however doesn't
+affect the :func:`format` function.
 
 The meaning of the various alignment options is as follows:
 

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


More information about the Python-checkins mailing list