[Python-checkins] r74912 - python/trunk/Lib/textwrap.py

georg.brandl python-checkins at python.org
Fri Sep 18 18:19:56 CEST 2009


Author: georg.brandl
Date: Fri Sep 18 18:19:56 2009
New Revision: 74912

Log:
Optimize optimization and fix method name in docstring.

Modified:
   python/trunk/Lib/textwrap.py

Modified: python/trunk/Lib/textwrap.py
==============================================================================
--- python/trunk/Lib/textwrap.py	(original)
+++ python/trunk/Lib/textwrap.py	Fri Sep 18 18:19:56 2009
@@ -156,7 +156,7 @@
         """_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 @@
         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:


More information about the Python-checkins mailing list