From d904f989125c0883338b086dbf94ac187b74cf7b Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sun, 6 Apr 2025 10:36:31 +0300 Subject: [PATCH 1/3] gh-131915: document 0-padding for string presentation type --- Doc/library/string.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index f2f3ab9eefdd50..876db9740c855b 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -426,7 +426,8 @@ If not specified, then the field width will be determined by the content. When no explicit alignment is given, preceding the *width* field by a zero (``'0'``) character enables sign-aware zero-padding for numeric types, excluding :class:`complex`. This is equivalent to a *fill* character of -``'0'`` with an *alignment* type of ``'='``. +``'0'`` with an *alignment* type of ``'='``. For strings this just enable +zero-padding with the default (or specified) alignment. .. versionchanged:: 3.10 Preceding the *width* field by ``'0'`` no longer affects the default From 3f545e08e93a06c22ae494a6053ed0107ef8e664 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sun, 6 Apr 2025 11:45:29 +0300 Subject: [PATCH 2/3] Update Doc/library/string.rst Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- Doc/library/string.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 876db9740c855b..60ea93622eaa40 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -426,7 +426,7 @@ If not specified, then the field width will be determined by the content. When no explicit alignment is given, preceding the *width* field by a zero (``'0'``) character enables sign-aware zero-padding for numeric types, excluding :class:`complex`. This is equivalent to a *fill* character of -``'0'`` with an *alignment* type of ``'='``. For strings this just enable +``'0'`` with an *alignment* type of ``'='``. For strings this enables zero-padding with the default (or specified) alignment. .. versionchanged:: 3.10 From e6ca2a1fc3b9a45966fb17a94820a8f32a258635 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sun, 6 Apr 2025 12:23:56 +0300 Subject: [PATCH 3/3] Update Doc/library/string.rst Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- Doc/library/string.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 60ea93622eaa40..65faa9cbb7268c 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -426,7 +426,7 @@ If not specified, then the field width will be determined by the content. When no explicit alignment is given, preceding the *width* field by a zero (``'0'``) character enables sign-aware zero-padding for numeric types, excluding :class:`complex`. This is equivalent to a *fill* character of -``'0'`` with an *alignment* type of ``'='``. For strings this enables +``'0'`` with an *alignment* type of ``'='``. For strings, this enables zero-padding with the default (or specified) alignment. .. versionchanged:: 3.10