Skip to content

Commit 01055a5

Browse files
tmblweedlisroach
authored andcommitted
bpo-30754: Document textwrap.dedent blank line behavior. (pythonGH-14469)
* Added documentation for textwrap.dedent behavior. * Remove an obsolete note about pre-2.5 behavior from the docstring.
1 parent 034a2cc commit 01055a5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Doc/library/textwrap.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ functions should be good enough; otherwise, you should use an instance of
7777
equal: the lines ``" hello"`` and ``"\thello"`` are considered to have no
7878
common leading whitespace.
7979

80+
Lines containing only whitespace are ignored in the input and normalized to a
81+
single newline character in the output.
82+
8083
For example::
8184

8285
def test():

Lib/textwrap.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,9 @@ def dedent(text):
420420

421421
Note that tabs and spaces are both treated as whitespace, but they
422422
are not equal: the lines " hello" and "\\thello" are
423-
considered to have no common leading whitespace. (This behaviour is
424-
new in Python 2.5; older versions of this module incorrectly
425-
expanded tabs before searching for common leading whitespace.)
423+
considered to have no common leading whitespace.
424+
425+
Entirely blank lines are normalized to a newline character.
426426
"""
427427
# Look for the longest leading string of spaces and tabs common to
428428
# all lines.

0 commit comments

Comments
 (0)