]> granicus.if.org Git - python/commitdiff
Tweak generation of unicode_whitespace_trans -- clearer, more
authorGreg Ward <gward@python.net>
Wed, 11 Dec 2002 13:54:20 +0000 (13:54 +0000)
committerGreg Ward <gward@python.net>
Wed, 11 Dec 2002 13:54:20 +0000 (13:54 +0000)
efficient.  Suggested by MAL.

Lib/textwrap.py

index 5860d7de63bc48953f5f3e46887ddf8b7633f063..be8587896a8c5b4da7673b7dfd3a9892cf32c93d 100644 (file)
@@ -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.