From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sun, 30 Jun 2019 04:41:55 +0000 (-0700) Subject: [2.7] bpo-30754: Document textwrap.dedent blank line behavior. (GH-14469) (GH-14475) X-Git-Tag: v2.7.17rc1~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc60c47169d1cb33f6fbe1ed64c09a536e82e1c3;p=thirdparty%2FPython%2Fcpython.git [2.7] bpo-30754: Document textwrap.dedent blank line behavior. (GH-14469) (GH-14475) * Added documentation for textwrap.dedent behavior. (cherry picked from commit eb97b9211e7c99841d6cae8c63893b3525d5a401) Co-authored-by: tmblweed https://bugs.python.org/issue30754 --- diff --git a/Doc/library/textwrap.rst b/Doc/library/textwrap.rst index a50600e464dc..6b0decb5a67f 100644 --- a/Doc/library/textwrap.rst +++ b/Doc/library/textwrap.rst @@ -66,6 +66,9 @@ indentation from strings that have unwanted whitespace to the left of the text. of this module incorrectly expanded tabs before searching for common leading whitespace.) + Lines containing only whitespace are ignored in the input and normalized to a + single newline character in the output. + For example:: def test(): diff --git a/Lib/textwrap.py b/Lib/textwrap.py index 5c2e4fa5237c..8d91ffa08176 100644 --- a/Lib/textwrap.py +++ b/Lib/textwrap.py @@ -383,6 +383,8 @@ def dedent(text): considered to have no common leading whitespace. (This behaviour is new in Python 2.5; older versions of this module incorrectly expanded tabs before searching for common leading whitespace.) + + Entirely blank lines are normalized to a newline character. """ # Look for the longest leading string of spaces and tabs common to # all lines.