summaryrefslogtreecommitdiffstats
path: root/Lib/textwrap.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2002-12-11 13:54:20 (GMT)
committerGreg Ward <gward@python.net>2002-12-11 13:54:20 (GMT)
commit0e88c9f65d163c0c8551d0f079a19b71a8a9e3ca (patch)
tree848cc2e33c1b412fe5e76e0e1125460322bdc8fb /Lib/textwrap.py
parent32b4a1ba62abe01684cbd1486274c7a40f81d78c (diff)
downloadcpython-0e88c9f65d163c0c8551d0f079a19b71a8a9e3ca.zip
cpython-0e88c9f65d163c0c8551d0f079a19b71a8a9e3ca.tar.gz
cpython-0e88c9f65d163c0c8551d0f079a19b71a8a9e3ca.tar.bz2
Tweak generation of unicode_whitespace_trans -- clearer, more
efficient. Suggested by MAL.
Diffstat (limited to 'Lib/textwrap.py')
-rw-r--r--Lib/textwrap.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/textwrap.py b/Lib/textwrap.py
index 5860d7d..be85878 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.