From 4902c46bff57f17b72cf68e8fafcc3f9b0df6f3c Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sun, 20 Mar 2016 21:05:57 -0400 Subject: [PATCH] Issue #15660: Further clarify 0 prefix for width specifier in formats. --- Doc/library/string.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 5b917d939be..1da0c670a9c 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -327,7 +327,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. | + | | valid for numeric types. It becomes the default when '0'| + | | immediately precedes the field width. | +---------+----------------------------------------------------------+ | ``'^'`` | Forces the field to be centered within the available | | | space. | @@ -376,7 +377,8 @@ instead. *width* is a decimal integer defining the minimum field width. If not specified, then the field width will be determined by the content. -Preceding the *width* field by a zero (``'0'``) character enables +When no explicit alignment is given, preceding the *width* field by a zero +(``'0'``) character enables sign-aware zero-padding for numeric types. This is equivalent to a *fill* character of ``'0'`` with an *alignment* type of ``'='``.