]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
use set
authorBenjamin Peterson <benjamin@python.org>
Tue, 21 Feb 2012 04:11:19 +0000 (23:11 -0500)
committerBenjamin Peterson <benjamin@python.org>
Tue, 21 Feb 2012 04:11:19 +0000 (23:11 -0500)
Lib/re.py

index 6a0174308969e4b8a0e8c5bf1a2d65192528c5ff..cc3813f80a0249dd73fd1e8f5d8a1ddf8e3d9c9e 100644 (file)
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -198,10 +198,7 @@ def template(pattern, flags=0):
     "Compile a template pattern, returning a pattern object"
     return _compile(pattern, flags|T)
 
-_alphanum = {}
-for c in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890':
-    _alphanum[c] = 1
-del c
+_alphanum = set('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890')
 
 def escape(pattern):
     "Escape all non-alphanumeric characters in pattern."