@@ -105,8 +105,8 @@ The constants defined in this module are:
105105
106106.. _new-string-formatting :
107107
108- String Formatting
109- -----------------
108+ Custom String Formatting
109+ ------------------------
110110
111111.. versionadded :: 2.6
112112
@@ -115,17 +115,17 @@ to do complex variable substitutions and value formatting via the
115115:meth: `str.format ` method described in :pep: `3101 `. The :class: `Formatter `
116116class in the :mod: `string ` module allows you to create and customize your own
117117string formatting behaviors using the same implementation as the built-in
118- :meth: `format ` method.
118+ :meth: `~str. format ` method.
119119
120120.. class :: Formatter
121121
122122 The :class: `Formatter ` class has the following public methods:
123123
124124 .. method :: format(format_string, *args, **kwargs)
125125
126- :meth: ` format ` is the primary API method. It takes a format string and
126+ The primary API method. It takes a format string and
127127 an arbitrary set of positional and keyword arguments.
128- :meth: ` format ` is just a wrapper that calls :meth: `vformat `.
128+ It is just a wrapper that calls :meth: `vformat `.
129129
130130 .. method :: vformat(format_string, args, kwargs)
131131
@@ -293,8 +293,9 @@ Most built-in types support a common formatting mini-language, which is
293293described in the next section.
294294
295295A *format_spec * field can also include nested replacement fields within it.
296- These nested replacement fields can contain only a field name; conversion flags
297- and format specifications are not allowed. The replacement fields within the
296+ These nested replacement fields may contain a field name, conversion flag
297+ and format specification, but deeper nesting is
298+ not allowed. The replacement fields within the
298299format_spec are substituted before the *format_spec * string is interpreted.
299300This allows the formatting of a value to be dynamically specified.
300301
@@ -332,8 +333,10 @@ The general form of a *standard format specifier* is:
332333
333334If a valid *align * value is specified, it can be preceded by a *fill *
334335character that can be any character and defaults to a space if omitted.
335- Note that it is not possible to use ``{ `` and ``} `` as *fill * char while
336- using the :meth: `str.format ` method; this limitation however doesn't
336+ It is not possible to use a literal curly brace ("``{ ``" or "``} ``") as
337+ the *fill * character when using the :meth: `str.format `
338+ method. However, it is possible to insert a curly brace
339+ with a nested replacement field. This limitation doesn't
337340affect the :func: `format ` function.
338341
339342The meaning of the various alignment options is as follows:
@@ -508,8 +511,8 @@ The available presentation types for floating point and decimal values are:
508511Format examples
509512^^^^^^^^^^^^^^^
510513
511- This section contains examples of the new format syntax and comparison with
512- the old ``% ``-formatting.
514+ This section contains examples of the :meth: ` str. format` syntax and
515+ comparison with the old ``% ``-formatting.
513516
514517In most of the cases the syntax is similar to the old ``% ``-formatting, with the
515518addition of the ``{} `` and with ``: `` used instead of ``% ``.
0 commit comments