@@ -75,14 +75,14 @@ The constants defined in this module are:
7575
7676.. _string-formatting :
7777
78- String Formatting
79- -----------------
78+ Custom String Formatting
79+ ------------------------
8080
8181The built-in string class provides the ability to do complex variable
82- substitutions and value formatting via the :func: ` format ` method described in
82+ substitutions and value formatting via the :meth: ` ~str. format ` method described in
8383:pep: `3101 `. The :class: `Formatter ` class in the :mod: `string ` module allows
8484you to create and customize your own string formatting behaviors using the same
85- implementation as the built-in :meth: `format ` method.
85+ implementation as the built-in :meth: `~str. format ` method.
8686
8787
8888.. class :: Formatter
@@ -91,9 +91,9 @@ implementation as the built-in :meth:`format` method.
9191
9292 .. method :: format(format_string, *args, **kwargs)
9393
94- :meth: ` format ` is the primary API method. It takes a format string and
94+ The primary API method. It takes a format string and
9595 an arbitrary set of positional and keyword arguments.
96- :meth: ` format ` is just a wrapper that calls :meth: `vformat `.
96+ It is just a wrapper that calls :meth: `vformat `.
9797
9898 .. deprecated :: 3.5
9999 Passing a format string as keyword argument *format_string * has been
@@ -267,8 +267,9 @@ Most built-in types support a common formatting mini-language, which is
267267described in the next section.
268268
269269A *format_spec * field can also include nested replacement fields within it.
270- These nested replacement fields can contain only a field name; conversion flags
271- and format specifications are not allowed. The replacement fields within the
270+ These nested replacement fields may contain a field name, conversion flag
271+ and format specification, but deeper nesting is
272+ not allowed. The replacement fields within the
272273format_spec are substituted before the *format_spec * string is interpreted.
273274This allows the formatting of a value to be dynamically specified.
274275
@@ -306,8 +307,10 @@ The general form of a *standard format specifier* is:
306307
307308If a valid *align * value is specified, it can be preceded by a *fill *
308309character that can be any character and defaults to a space if omitted.
309- Note that it is not possible to use ``{ `` and ``} `` as *fill * char while
310- using the :meth: `str.format ` method; this limitation however doesn't
310+ It is not possible to use a literal curly brace ("``{ ``" or "``} ``") as
311+ the *fill * character when using the :meth: `str.format `
312+ method. However, it is possible to insert a curly brace
313+ with a nested replacement field. This limitation doesn't
311314affect the :func: `format ` function.
312315
313316The meaning of the various alignment options is as follows:
@@ -496,8 +499,8 @@ The available presentation types for floating point and decimal values are:
496499Format examples
497500^^^^^^^^^^^^^^^
498501
499- This section contains examples of the new format syntax and comparison with
500- the old ``% ``-formatting.
502+ This section contains examples of the :meth: ` str. format` syntax and
503+ comparison with the old ``% ``-formatting.
501504
502505In most of the cases the syntax is similar to the old ``% ``-formatting, with the
503506addition of the ``{} `` and with ``: `` used instead of ``% ``.
0 commit comments