From: Greg Ward Date: Thu, 8 May 2003 02:02:50 +0000 (+0000) Subject: Minor clarification of dedent(). X-Git-Tag: v2.3c1~807 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2557100b9ef3b75d05fd85534b4d75792fd68ab3;p=thirdparty%2FPython%2Fcpython.git Minor clarification of dedent(). --- diff --git a/Lib/textwrap.py b/Lib/textwrap.py index ec0e7cbe0160..754b037323ea 100644 --- a/Lib/textwrap.py +++ b/Lib/textwrap.py @@ -334,16 +334,16 @@ def dedent(text): lines = text.expandtabs().split('\n') margin = None for line in lines: - content = len(line.lstrip()) + content = line.lstrip() if not content: continue - indent = len(line) - content + indent = len(line) - len(content) if margin is None: margin = indent else: margin = min(margin, indent) - if margin is not None: + if margin is not None and margin > 0: for i in range(len(lines)): lines[i] = lines[i][margin:]