From: Greg Ward Date: Thu, 13 May 2004 01:48:15 +0000 (+0000) Subject: SF #847346: remove misguided optimization for short input from X-Git-Tag: v2.3.4c1~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=27262316fbd97d83910fbc3c73851fd94f29be55;p=thirdparty%2FPython%2Fcpython.git SF #847346: remove misguided optimization for short input from wrap() method. Premature optimization is indeed the root of all evil. Whitespace fix. --- diff --git a/Lib/textwrap.py b/Lib/textwrap.py index f371fbbe5ac7..d9df01928c61 100644 --- a/Lib/textwrap.py +++ b/Lib/textwrap.py @@ -90,14 +90,14 @@ class TextWrapper: % string.lowercase) - def __init__ (self, - width=70, - initial_indent="", - subsequent_indent="", - expand_tabs=True, - replace_whitespace=True, - fix_sentence_endings=False, - break_long_words=True): + def __init__(self, + width=70, + initial_indent="", + subsequent_indent="", + expand_tabs=True, + replace_whitespace=True, + fix_sentence_endings=False, + break_long_words=True): self.width = width self.initial_indent = initial_indent self.subsequent_indent = subsequent_indent @@ -268,8 +268,6 @@ class TextWrapper: """ text = self._munge_whitespace(text) indent = self.initial_indent - if len(text) + len(indent) <= self.width: - return [indent + text] chunks = self._split(text) if self.fix_sentence_endings: self._fix_sentence_endings(chunks)