mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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))
|
||||
|
||||
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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue