From 6312b39521be401af5c187f9aa4200a446dab8b8 Mon Sep 17 00:00:00 2001 From: "d.grigonis" Date: Mon, 3 Feb 2025 16:39:09 +0200 Subject: [PATCH 1/4] init --- Doc/library/string.rst | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 09165c481b246e..3b8f0058790f78 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -116,6 +116,9 @@ implementation as the built-in :meth:`~str.format` method. into character data and replacement fields. It calls the various methods described below. + Auto-numbering of non-numbered positional fields is done after + calling :meth:`parse` and before :meth:`get_field`. + In addition, the :class:`Formatter` defines a number of methods that are intended to be replaced by subclasses: @@ -133,14 +136,18 @@ implementation as the built-in :meth:`~str.format` method. field, then the values of *field_name*, *format_spec* and *conversion* will be ``None``. + The value of *field_name* is unmodified user input and auto-numbering of + non-numbered positional fields is done by :meth:`vformat`. + .. method:: get_field(field_name, args, kwargs) - Given *field_name* as returned by :meth:`parse` (see above), convert it to - an object to be formatted. Returns a tuple (obj, used_key). The default - version takes strings of the form defined in :pep:`3101`, such as - "0[name]" or "label.title". *args* and *kwargs* are as passed in to - :meth:`vformat`. The return value *used_key* has the same meaning as the - *key* parameter to :meth:`get_value`. + Given *field_name*, convert it to an object to be formatted. + Auto-numbering of *field_name* returned from :meth:`parse` is done by + :meth:`vformat` before calling this method. Returns a tuple (obj, used_key). + The default version takes strings of the form defined in :pep:`3101`, + such as "0[name]" or "label.title". *args* and *kwargs* are as passed in to + :meth:`vformat`. The return value *used_key* has the same meaning + as the *key* parameter to :meth:`get_value`. .. method:: get_value(key, args, kwargs) From 1b10b8ccd3f4143db59bec6c6611bd03bc675f9b Mon Sep 17 00:00:00 2001 From: "d.grigonis" Date: Mon, 3 Feb 2025 16:43:44 +0200 Subject: [PATCH 2/4] edit --- Doc/library/string.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 3b8f0058790f78..24c1f7c7780cd5 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -136,7 +136,7 @@ implementation as the built-in :meth:`~str.format` method. field, then the values of *field_name*, *format_spec* and *conversion* will be ``None``. - The value of *field_name* is unmodified user input and auto-numbering of + The value of *field_name* is unmodified and auto-numbering of non-numbered positional fields is done by :meth:`vformat`. .. method:: get_field(field_name, args, kwargs) From f8cca7e4a03097e3a3d2ba4f7ed89f6e320ea66b Mon Sep 17 00:00:00 2001 From: "d.grigonis" Date: Mon, 3 Feb 2025 16:48:52 +0200 Subject: [PATCH 3/4] edit2 --- Doc/library/string.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 24c1f7c7780cd5..11f11b45c92181 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -134,10 +134,8 @@ implementation as the built-in :meth:`~str.format` method. (which can happen if two replacement fields occur consecutively), then *literal_text* will be a zero-length string. If there is no replacement field, then the values of *field_name*, *format_spec* and *conversion* - will be ``None``. - - The value of *field_name* is unmodified and auto-numbering of - non-numbered positional fields is done by :meth:`vformat`. + will be ``None``. The value of *field_name* is unmodified and + auto-numbering of non-numbered positional fields is done by :meth:`vformat`. .. method:: get_field(field_name, args, kwargs) From 1f64c6b483be6980a5e09550300bcadbda533a43 Mon Sep 17 00:00:00 2001 From: "d.grigonis" Date: Mon, 3 Feb 2025 20:07:22 +0200 Subject: [PATCH 4/4] edit3 --- Doc/library/string.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 11f11b45c92181..92f8b496df9bee 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -116,9 +116,6 @@ implementation as the built-in :meth:`~str.format` method. into character data and replacement fields. It calls the various methods described below. - Auto-numbering of non-numbered positional fields is done after - calling :meth:`parse` and before :meth:`get_field`. - In addition, the :class:`Formatter` defines a number of methods that are intended to be replaced by subclasses: