Commit 195261f8 authored by Georg Brandl's avatar Georg Brandl

Optimize optimization and fix method name in docstring.

parent b0199518
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment