mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
use set
This commit is contained in:
parent
f093724845
commit
740593416a
1 changed files with 1 additions and 4 deletions
|
@ -198,10 +198,7 @@ def template(pattern, flags=0):
|
||||||
"Compile a template pattern, returning a pattern object"
|
"Compile a template pattern, returning a pattern object"
|
||||||
return _compile(pattern, flags|T)
|
return _compile(pattern, flags|T)
|
||||||
|
|
||||||
_alphanum = {}
|
_alphanum = set('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890')
|
||||||
for c in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890':
|
|
||||||
_alphanum[c] = 1
|
|
||||||
del c
|
|
||||||
|
|
||||||
def escape(pattern):
|
def escape(pattern):
|
||||||
"Escape all non-alphanumeric characters in pattern."
|
"Escape all non-alphanumeric characters in pattern."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue