]> granicus.if.org Git - python/commitdiff
Optimize optimization and fix method name in docstring.
authorGeorg Brandl <georg@python.org>
Fri, 18 Sep 2009 16:19:56 +0000 (16:19 +0000)
committerGeorg Brandl <georg@python.org>
Fri, 18 Sep 2009 16:19:56 +0000 (16:19 +0000)
Lib/textwrap.py

index 64a5b97c92a57e5fb5944a2c4781c94ce8e59831..9582a1c02f5c39e85bf1b8addf3f947ea7b0dde7 100644 (file)
@@ -156,7 +156,7 @@ class TextWrapper:
         """_split(text : string) -> [string]
 
         Split the text to wrap into indivisible chunks.  Chunks are
-        not quite the same as words; see wrap_chunks() for full
+        not quite the same as words; see _wrap_chunks() for full
         details.  As an example, the text
           Look, goof-ball -- use the -b option!
         breaks into the following chunks:
@@ -191,9 +191,9 @@ class TextWrapper:
         space to two.
         """
         i = 0
-        pat = self.sentence_end_re
+        patsearch = self.sentence_end_re.search
         while i < len(chunks)-1:
-            if chunks[i+1] == " " and pat.search(chunks[i]):
+            if chunks[i+1] == " " and patsearch(chunks[i]):
                 chunks[i+1] = "  "
                 i += 2
             else: