summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-10-14 20:03:40 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2002-10-14 20:03:40 (GMT)
commit5357c6511dcac17e1c80dbdeaea6c1016f44f4e5 (patch)
tree7d547ecd7486df239eac0fa3f3aee19c8caadab6 /Lib
parentbbc0568a5c7d3849a22c78d545823a4b952c0933 (diff)
downloadcpython-5357c6511dcac17e1c80dbdeaea6c1016f44f4e5.zip
cpython-5357c6511dcac17e1c80dbdeaea6c1016f44f4e5.tar.gz
cpython-5357c6511dcac17e1c80dbdeaea6c1016f44f4e5.tar.bz2
Convert empty string literal to string. Speed up creation of idmap.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/string.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/string.py b/Lib/string.py
index 1d452ed..ec796f6 100644
--- a/Lib/string.py
+++ b/Lib/string.py
@@ -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