#2650: Refactor re.escape to use enumerate().

This commit is contained in:
Ezio Melotti 2011-03-25 14:19:30 +02:00
parent 7b9e97b487
commit ebbf1e67a8
1 changed files with 1 additions and 2 deletions

View File

@ -223,8 +223,7 @@ def escape(pattern):
if isinstance(pattern, str):
alphanum = _alphanum_str
s = list(pattern)
for i in range(len(pattern)):
c = pattern[i]
for i, c in enumerate(pattern):
if c not in alphanum:
if c == "\000":
s[i] = "\\000"