aboutsummaryrefslogtreecommitdiff
path: root/Doc
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2021-01-25 11:56:33 +0200
committerGitHub <noreply@github.com>2021-01-25 11:56:33 +0200
commitcf19cc3b920ca5995e1c202d2c3dd7a59ac8eac8 (patch)
tree114c6f03de6e732ca7b81bd60d48b1a7f7968b33 /Doc
parent bpo-43013: Update idlelib code to 3.x (GH-24315) (diff)
downloadcpython-cf19cc3b920ca5995e1c202d2c3dd7a59ac8eac8.tar.gz
cpython-cf19cc3b920ca5995e1c202d2c3dd7a59ac8eac8.tar.bz2
cpython-cf19cc3b920ca5995e1c202d2c3dd7a59ac8eac8.zip
bpo-27772: Make preceding width with 0 valid in string format. (GH-11270)
Previously it was an error with confusing error message.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/string.rst8
1 files changed, 6 insertions, 2 deletions
diff --git a/Doc/library/string.rst b/Doc/library/string.rst
index 54786d0c2ab..1bfd518349b 100644
--- a/Doc/library/string.rst
+++ b/Doc/library/string.rst
@@ -347,8 +347,8 @@ The meaning of the various alignment options is as follows:
| ``'='`` | Forces the padding to be placed after the sign (if any) |
| | but before the digits. This is used for printing fields |
| | in the form '+000000120'. This alignment option is only |
- | | valid for numeric types. It becomes the default when '0'|
- | | immediately precedes the field width. |
+ | | valid for numeric types. It becomes the default for |
+ | | numbers when '0' immediately precedes the field width. |
+---------+----------------------------------------------------------+
| ``'^'`` | Forces the field to be centered within the available |
| | space. |
@@ -424,6 +424,10 @@ When no explicit alignment is given, preceding the *width* field by a zero
sign-aware zero-padding for numeric types. This is equivalent to a *fill*
character of ``'0'`` with an *alignment* type of ``'='``.
+.. versionchanged:: 3.10
+ 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