diff options
author | Greg Ward <gward@python.net> | 2003-02-03 14:46:57 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2003-02-03 14:46:57 (GMT) |
commit | 4c6c9c42fbe6ec3ba7f7aed9c9d172e459941739 (patch) | |
tree | d3ae7c010aa9ae06ec609c937e82b9dc30811f9c | |
parent | 7a2d7a74fc73aa791260625a8592edbdefb5012f (diff) | |
download | cpython-4c6c9c42fbe6ec3ba7f7aed9c9d172e459941739.zip cpython-4c6c9c42fbe6ec3ba7f7aed9c9d172e459941739.tar.gz cpython-4c6c9c42fbe6ec3ba7f7aed9c9d172e459941739.tar.bz2 |
Add __all__ (suggested by Raymond Hettinger).
Rename 'whitespace' global to '_whitespace' -- it's not part of the
public interface.
-rw-r--r-- | Lib/textwrap.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/textwrap.py b/Lib/textwrap.py index de07c8d..c8a1dac 100644 --- a/Lib/textwrap.py +++ b/Lib/textwrap.py @@ -12,6 +12,8 @@ __revision__ = "$Id$" import string, re +__all__ = ['TextWrapper', 'wrap', 'fill'] + # Hardcode the recognized whitespace characters to the US-ASCII # whitespace characters. The main reason for doing this is that in # ISO-8859-1, 0xa0 is non-breaking whitespace, so in certain locales @@ -20,7 +22,7 @@ import string, re # same as any other whitespace char, which is clearly wrong (it's a # *non-breaking* space), 2) possibly cause problems with Unicode, # since 0xa0 is not in range(128). -whitespace = '\t\n\x0b\x0c\r ' +_whitespace = '\t\n\x0b\x0c\r ' class TextWrapper: """ @@ -58,11 +60,11 @@ class TextWrapper: be broken, and some lines might be longer than 'width'. """ - whitespace_trans = string.maketrans(whitespace, ' ' * len(whitespace)) + whitespace_trans = string.maketrans(_whitespace, ' ' * len(_whitespace)) unicode_whitespace_trans = {} uspace = ord(u' ') - for x in map(ord, whitespace): + for x in map(ord, _whitespace): unicode_whitespace_trans[x] = uspace # This funky little regex is just the trick for splitting |