Skip to content

Commit 1d6ce67

Browse files
authored
Corrections to format precision description. (GH-31291)
* `precision` field is a decimal integer * clarify that stated limitations are on presentation type rather than input value type. Especially misleading is "precision is not allowed for integer values", since integer value input to a format like `.1f` is fine. * regarding max field size, replace "non-number" with "string", which is the only non-numeric presentation type Automerge-Triggered-By: GH:ericvsmith
1 parent 0ae4019 commit 1d6ce67

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Doc/library/string.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,12 +428,13 @@ character of ``'0'`` with an *alignment* type of ``'='``.
428428
Preceding the *width* field by ``'0'`` no longer affects the default
429429
alignment for strings.
430430

431-
The *precision* is a decimal number indicating how many digits should be
432-
displayed after the decimal point for a floating point value formatted with
433-
``'f'`` and ``'F'``, or before and after the decimal point for a floating point
434-
value formatted with ``'g'`` or ``'G'``. For non-number types the field
431+
The *precision* is a decimal integer indicating how many digits should be
432+
displayed after the decimal point for presentation types
433+
``'f'`` and ``'F'``, or before and after the decimal point for presentation
434+
types ``'g'`` or ``'G'``. For string presentation types the field
435435
indicates the maximum field size - in other words, how many characters will be
436-
used from the field content. The *precision* is not allowed for integer values.
436+
used from the field content. The *precision* is not allowed for integer
437+
presentation types.
437438

438439
Finally, the *type* determines how the data should be presented.
439440

0 commit comments

Comments
 (0)