From: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Date: Sun, 18 May 2025 08:10:54 +0000 (+0200) Subject: gh-134082: modernize `string.Formatter` class docstring (#134125) X-Git-Tag: v3.15.0a1~1685 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22e4a40d9089dde2f1578c4b320f27b20e2e125b;p=thirdparty%2FPython%2Fcpython.git gh-134082: modernize `string.Formatter` class docstring (#134125) fixup Formatter class docstring --- diff --git a/Lib/string/__init__.py b/Lib/string/__init__.py index b7782e042b94..b788d7136f1a 100644 --- a/Lib/string/__init__.py +++ b/Lib/string/__init__.py @@ -191,16 +191,14 @@ class Template: ######################################################################## -# the Formatter class -# see PEP 3101 for details and purpose of this class - -# The hard parts are reused from the C implementation. They're exposed as "_" -# prefixed methods of str. - +# The Formatter class (PEP 3101). +# # The overall parser is implemented in _string.formatter_parser. -# The field name parser is implemented in _string.formatter_field_name_split +# The field name parser is implemented in _string.formatter_field_name_split. class Formatter: + """See PEP 3101 for details and purpose of this class.""" + def format(self, format_string, /, *args, **kwargs): return self.vformat(format_string, args, kwargs) @@ -293,7 +291,6 @@ class Formatter: Return an iterable that contains tuples of the form (literal_text, field_name, format_spec, conversion). - *field_name* can be None, in which case there's no object to format and output; otherwise, it is looked up and formatted with *format_spec* and *conversion*.