diff options
author | Greg Ward <gward@python.net> | 2002-12-11 13:54:20 +0000 |
---|---|---|
committer | Greg Ward <gward@python.net> | 2002-12-11 13:54:20 +0000 |
commit | 6ff52808d43f2e486dee8f86b66dbdd41e23586d (patch) | |
tree | e481a65cebb7aabd5d0f67d929338bfc8756a2f9 | |
parent | 77c569f33c9895ec61eef1758ebfbe1618da143b (diff) | |
download | cpython-6ff52808d43f2e486dee8f86b66dbdd41e23586d.tar.gz |
Tweak generation of unicode_whitespace_trans -- clearer, more
efficient. Suggested by MAL.
-rw-r--r-- | Lib/textwrap.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/textwrap.py b/Lib/textwrap.py index 5860d7de63..be8587896a 100644 --- a/Lib/textwrap.py +++ b/Lib/textwrap.py @@ -52,8 +52,9 @@ class TextWrapper: ' ' * len(string.whitespace)) unicode_whitespace_trans = {} - for c in string.whitespace: - unicode_whitespace_trans[ord(unicode(c))] = ord(u' ') + uspace = ord(u' ') + for x in map(ord, string.whitespace): + unicode_whitespace_trans[x] = uspace # This funky little regex is just the trick for splitting # text up into word-wrappable chunks. E.g. |