Skip to content

Commit bc60c47

Browse files
[2.7] bpo-30754: Document textwrap.dedent blank line behavior. (GH-14469) (GH-14475)
* Added documentation for textwrap.dedent behavior. (cherry picked from commit eb97b92) Co-authored-by: tmblweed <[email protected]> https://bugs.python.org/issue30754
1 parent 065aff3 commit bc60c47

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Doc/library/textwrap.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ indentation from strings that have unwanted whitespace to the left of the text.
6666
of this module incorrectly expanded tabs before searching for common leading
6767
whitespace.)
6868

69+
Lines containing only whitespace are ignored in the input and normalized to a
70+
single newline character in the output.
71+
6972
For example::
7073

7174
def test():

Lib/textwrap.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ def dedent(text):
383383
considered to have no common leading whitespace. (This behaviour is
384384
new in Python 2.5; older versions of this module incorrectly
385385
expanded tabs before searching for common leading whitespace.)
386+
387+
Entirely blank lines are normalized to a newline character.
386388
"""
387389
# Look for the longest leading string of spaces and tabs common to
388390
# all lines.

0 commit comments

Comments
 (0)