diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index b0388c4e1f0bd4..a01a6d26acb3ac 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -3218,6 +3218,12 @@ The conversion types are: | | character in the result. | | +------------+-----------------------------------------------------+-------+ +For a general non-string Python object ``obj``, numeric conversion types +attempt to format values, converted first to built-in :class:`float` (by +``float(obj)``, for floating-point formats) and :class:`int` (by +``operator.index(obj)`` for ``'o'``, ``'x'``, ``'X'`` or ``'c'`` formats, or by +``int(obj)`` for other integer formats) types. + For floating-point formats, the result should be correctly rounded to a given precision ``p`` of digits after the decimal point. The rounding mode matches that of the :func:`round` builtin. diff --git a/Doc/library/string.rst b/Doc/library/string.rst index be968a3c53d843..929e1367983b9b 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -660,7 +660,7 @@ Format examples ^^^^^^^^^^^^^^^ This section contains examples of the :meth:`str.format` syntax and -comparison with the old ``%``-formatting. +comparison with the old :ref:`printf-style formatting `. In most of the cases the syntax is similar to the old ``%``-formatting, with the addition of the ``{}`` and with ``:`` used instead of ``%``.