mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Tweak generation of unicode_whitespace_trans -- clearer, more
efficient. Suggested by MAL.
This commit is contained in:
parent
32b4a1ba62
commit
0e88c9f65d
1 changed files with 3 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue