]> granicus.if.org Git - python/commitdiff
bpo-30754: Document textwrap.dedent blank line behavior. (GH-14469)
authortmblweed <tmblweed@users.noreply.github.com>
Sun, 30 Jun 2019 04:20:03 +0000 (21:20 -0700)
committerGregory P. Smith <greg@krypto.org>
Sun, 30 Jun 2019 04:20:03 +0000 (21:20 -0700)
* Added documentation for textwrap.dedent behavior.
* Remove an obsolete note about pre-2.5 behavior from the docstring.

Doc/library/textwrap.rst
Lib/textwrap.py

index d254466c9a320d8ea9e13b28de8261cd42e314c8..0f11ef401569de600fe0194f62475cc66cf7ce1d 100644 (file)
@@ -77,6 +77,9 @@ functions should be good enough; otherwise, you should use an instance of
    equal: the lines ``"  hello"`` and ``"\thello"`` are considered to have no
    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():
index 8103f347452d35b273f56ee9c280080becbc6205..30e693c8de03548344a038d0dc946e1d3a3ca8d0 100644 (file)
@@ -420,9 +420,9 @@ def dedent(text):
 
     Note that tabs and spaces are both treated as whitespace, but they
     are not equal: the lines "  hello" and "\\thello" are
-    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.)
+    considered to have no 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.