[Python-checkins] cpython (2.7): a frozenset is better here

benjamin.peterson python-checkins at python.org
Tue Feb 21 05:13:31 CET 2012


http://hg.python.org/cpython/rev/475d5a749756
changeset:   75113:475d5a749756
branch:      2.7
user:        Benjamin Peterson <benjamin at python.org>
date:        Mon Feb 20 23:13:20 2012 -0500
summary:
  a frozenset is better here

files:
  Lib/re.py |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Lib/re.py b/Lib/re.py
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -198,7 +198,8 @@
     "Compile a template pattern, returning a pattern object"
     return _compile(pattern, flags|T)
 
-_alphanum = set('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890')
+_alphanum = frozenset(
+    "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890")
 
 def escape(pattern):
     "Escape all non-alphanumeric characters in pattern."

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list