]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
SF #847346: remove misguided optimization for short input from
authorGreg Ward <gward@python.net>
Thu, 13 May 2004 01:48:15 +0000 (01:48 +0000)
committerGreg Ward <gward@python.net>
Thu, 13 May 2004 01:48:15 +0000 (01:48 +0000)
wrap() method.  Premature optimization is indeed the root of all evil.
Whitespace fix.

Lib/textwrap.py

index f371fbbe5ac7d8221277226969a0d61ca66eaadd..d9df01928c61dbc77bacfc1dc960a5233d1b3b90 100644 (file)
@@ -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)