mirror of https://github.com/python/cpython
Tweak generation of unicode_whitespace_trans -- clearer, more
efficient. Suggested by MAL.
This commit is contained in:
parent
32b4a1ba62
commit
0e88c9f65d
|
@ -52,8 +52,9 @@ class TextWrapper:
|
||||||
' ' * len(string.whitespace))
|
' ' * len(string.whitespace))
|
||||||
|
|
||||||
unicode_whitespace_trans = {}
|
unicode_whitespace_trans = {}
|
||||||
for c in string.whitespace:
|
uspace = ord(u' ')
|
||||||
unicode_whitespace_trans[ord(unicode(c))] = ord(u' ')
|
for x in map(ord, string.whitespace):
|
||||||
|
unicode_whitespace_trans[x] = uspace
|
||||||
|
|
||||||
# This funky little regex is just the trick for splitting
|
# This funky little regex is just the trick for splitting
|
||||||
# text up into word-wrappable chunks. E.g.
|
# text up into word-wrappable chunks. E.g.
|
||||||
|
|
Loading…
Reference in New Issue