File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -240,15 +240,18 @@ floating-point flying circus:
240240 >>> c % a
241241 Decimal('0.77')
242242
243- Decimals can be formatted in fixed-point or scientific notation, using the same
244- formatting syntax (see :ref: `formatspec `) as builtin :class: `float ` type:
243+ Decimals can be formatted (with :func: `format ` built-in or :ref: `f-strings `) in
244+ fixed-point or scientific notation, using the same formatting syntax (see
245+ :ref: `formatspec `) as builtin :class: `float ` type:
245246
246247.. doctest ::
247248
248249 >>> format (Decimal(' 2.675' ), " f" )
249250 '2.675'
250251 >>> format (Decimal(' 2.675' ), " .2f" )
251252 '2.68'
253+ >>> f " { Decimal(' 2.675' ):.2f } "
254+ '2.68'
252255 >>> format (Decimal(' 2.675' ), " .2e" )
253256 '2.68e+0'
254257 >>> with localcontext() as ctx:
You can’t perform that action at this time.
0 commit comments