diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst index d3975ab4446435..146cf5dbaf29b1 100644 --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -240,8 +240,9 @@ floating-point flying circus: >>> c % a Decimal('0.77') -Decimals can be formatted in fixed-point or scientific notation, using the same -formatting syntax (see :ref:`formatspec`) as builtin :class:`float` type: +Decimals can be formatted (with :func:`format` built-in or :ref:`f-strings`) in +fixed-point or scientific notation, using the same formatting syntax (see +:ref:`formatspec`) as builtin :class:`float` type: .. doctest:: @@ -249,6 +250,8 @@ formatting syntax (see :ref:`formatspec`) as builtin :class:`float` type: '2.675' >>> format(Decimal('2.675'), ".2f") '2.68' + >>> f"{Decimal('2.675'):.2f}" + '2.68' >>> format(Decimal('2.675'), ".2e") '2.68e+0' >>> with localcontext() as ctx: