Commit cf694eae authored by Ezio Melotti's avatar Ezio Melotti

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

parent 39b936a3
...@@ -223,8 +223,7 @@ def escape(pattern): ...@@ -223,8 +223,7 @@ def escape(pattern):
if isinstance(pattern, str): if isinstance(pattern, str):
alphanum = _alphanum_str alphanum = _alphanum_str
s = list(pattern) s = list(pattern)
for i in range(len(pattern)): for i, c in enumerate(pattern):
c = pattern[i]
if c not in alphanum: if c not in alphanum:
if c == "\000": if c == "\000":
s[i] = "\\000" s[i] = "\\000"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment