Skip to content

Commit a4b7128

Browse files
authored
pythongh-89867: string.Formatter auto numbering doc updates (pythonGH-129617)
1 parent b1f8938 commit a4b7128

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Doc/library/string.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,18 @@ implementation as the built-in :meth:`~str.format` method.
131131
(which can happen if two replacement fields occur consecutively), then
132132
*literal_text* will be a zero-length string. If there is no replacement
133133
field, then the values of *field_name*, *format_spec* and *conversion*
134-
will be ``None``.
134+
will be ``None``. The value of *field_name* is unmodified and
135+
auto-numbering of non-numbered positional fields is done by :meth:`vformat`.
135136

136137
.. method:: get_field(field_name, args, kwargs)
137138

138-
Given *field_name* as returned by :meth:`parse` (see above), convert it to
139-
an object to be formatted. Returns a tuple (obj, used_key). The default
140-
version takes strings of the form defined in :pep:`3101`, such as
141-
"0[name]" or "label.title". *args* and *kwargs* are as passed in to
142-
:meth:`vformat`. The return value *used_key* has the same meaning as the
143-
*key* parameter to :meth:`get_value`.
139+
Given *field_name*, convert it to an object to be formatted.
140+
Auto-numbering of *field_name* returned from :meth:`parse` is done by
141+
:meth:`vformat` before calling this method. Returns a tuple (obj, used_key).
142+
The default version takes strings of the form defined in :pep:`3101`,
143+
such as "0[name]" or "label.title". *args* and *kwargs* are as passed in to
144+
:meth:`vformat`. The return value *used_key* has the same meaning
145+
as the *key* parameter to :meth:`get_value`.
144146

145147
.. method:: get_value(key, args, kwargs)
146148

0 commit comments

Comments
 (0)