gh-101100: Fix broken reference `__format__` in `string.rst` (#103531)

This commit is contained in:
yuki 2023-04-18 20:18:53 +09:00 committed by GitHub
parent ece20dba12
commit c3d015ce62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -254,10 +254,10 @@ Some simple format string examples::
"Units destroyed: {players[0]}" # First element of keyword argument 'players'. "Units destroyed: {players[0]}" # First element of keyword argument 'players'.
The *conversion* field causes a type coercion before formatting. Normally, the The *conversion* field causes a type coercion before formatting. Normally, the
job of formatting a value is done by the :meth:`__format__` method of the value job of formatting a value is done by the :meth:`~object.__format__` method of the value
itself. However, in some cases it is desirable to force a type to be formatted itself. However, in some cases it is desirable to force a type to be formatted
as a string, overriding its own definition of formatting. By converting the as a string, overriding its own definition of formatting. By converting the
value to a string before calling :meth:`__format__`, the normal formatting logic value to a string before calling :meth:`~object.__format__`, the normal formatting logic
is bypassed. is bypassed.
Three conversion flags are currently supported: ``'!s'`` which calls :func:`str` Three conversion flags are currently supported: ``'!s'`` which calls :func:`str`