[Python-checkins] cpython (3.1): #2650: Refactor re.escape to use enumerate().

ezio.melotti python-checkins at python.org
Fri Mar 25 13:27:15 CET 2011


http://hg.python.org/cpython/rev/ed02db9921ac
changeset: 68924:ed02db9921ac
branch: 3.1
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Fri Mar 25 14:19:30 2011 +0200
summary:
 #2650: Refactor re.escape to use enumerate().
files:
 Lib/re.py | 3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/Lib/re.py b/Lib/re.py
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -223,8 +223,7 @@
 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円"
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /