diff options
author | John Belmonte <john@neggie.net> | 2022-02-14 00:00:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-14 00:00:32 (GMT) |
commit | 1d6ce67c29aa2166ef326952cb605b908fb4f987 (patch) | |
tree | 41f430f6bdbd72b1012dae433f4aa732c339179c /Doc | |
parent | 0ae40191793da1877a12d512f0116d99301b2c51 (diff) | |
download | cpython-1d6ce67c29aa2166ef326952cb605b908fb4f987.zip cpython-1d6ce67c29aa2166ef326952cb605b908fb4f987.tar.gz cpython-1d6ce67c29aa2166ef326952cb605b908fb4f987.tar.bz2 |
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
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/string.rst | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 9bc703e..78bd167 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -428,12 +428,13 @@ character of ``'0'`` with an *alignment* type of ``'='``. Preceding the *width* field by ``'0'`` no longer affects the default alignment for strings. -The *precision* is a decimal number indicating how many digits should be -displayed after the decimal point for a floating point value formatted with -``'f'`` and ``'F'``, or before and after the decimal point for a floating point -value formatted with ``'g'`` or ``'G'``. For non-number types the field +The *precision* is a decimal integer indicating how many digits should be +displayed after the decimal point for presentation types +``'f'`` and ``'F'``, or before and after the decimal point for presentation +types ``'g'`` or ``'G'``. For string presentation types the field indicates the maximum field size - in other words, how many characters will be -used from the field content. The *precision* is not allowed for integer values. +used from the field content. The *precision* is not allowed for integer +presentation types. Finally, the *type* determines how the data should be presented. |