From: Greg Ward Date: Wed, 11 Dec 2002 13:54:20 +0000 (+0000) Subject: Tweak generation of unicode_whitespace_trans -- clearer, more X-Git-Tag: v2.3c1~3067 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0e88c9f65d163c0c8551d0f079a19b71a8a9e3ca;p=python Tweak generation of unicode_whitespace_trans -- clearer, more efficient. Suggested by MAL. --- 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.