diff options
author | Greg Ward <gward@python.net> | 2003-05-08 02:02:50 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2003-05-08 02:02:50 (GMT) |
commit | 2557100b9ef3b75d05fd85534b4d75792fd68ab3 (patch) | |
tree | 25d4829ab0147d5f7196021b1d113a287df4505d /Lib/textwrap.py | |
parent | 9e082f4eae34315bd256874ff0632c8192730736 (diff) | |
download | cpython-2557100b9ef3b75d05fd85534b4d75792fd68ab3.zip cpython-2557100b9ef3b75d05fd85534b4d75792fd68ab3.tar.gz cpython-2557100b9ef3b75d05fd85534b4d75792fd68ab3.tar.bz2 |
Minor clarification of dedent().
Diffstat (limited to 'Lib/textwrap.py')
-rw-r--r-- | Lib/textwrap.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/textwrap.py b/Lib/textwrap.py index ec0e7cb..754b037 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:] |