diff Lib/string.py @ 25786:af20aeaaa982 legacy-trunk

Convert empty string literal to string. Speed up creation of idmap.
author Martin v. Löwis <martin@v.loewis.de>
date Mon, 14 Oct 2002 20:03:40 +0000
parents e1e90b0f1f45
children ef3f6929fc0e
line wrap: on
line diff
--- a/Lib/string.py	Mon Oct 14 19:59:54 2002 +0000
+++ b/Lib/string.py	Mon Oct 14 20:03:40 2002 +0000
@@ -34,9 +34,10 @@
 printable = digits + letters + punctuation + whitespace
 
 # Case conversion helpers
-_idmap = ''
-for i in range(256): _idmap = _idmap + chr(i)
-del i
+# Use str to convert Unicode literal in case of -U
+l = map(chr, xrange(256))
+_idmap = str('').join(l)
+del l
 
 # Backward compatible names for exceptions
 index_error = ValueError