]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Convert empty string literal to string. Speed up creation of idmap.
authorMartin v. Löwis <martin@v.loewis.de>
Mon, 14 Oct 2002 20:03:40 +0000 (20:03 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Mon, 14 Oct 2002 20:03:40 +0000 (20:03 +0000)
Lib/string.py

index 1d452edf95c691a108a4825a3bb7143b18e07e8e..ec796f63adb2a2899e2b6e3fa3640ecc9a143a30 100644 (file)
@@ -34,9 +34,10 @@ punctuation = """!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
 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