A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-March/110159.html below:

Refactor re.escape to use enumerate().

[Python-Dev] cpython (3.1): #2650: Refactor re.escape to use enumerate(). [Python-Dev] cpython (3.1): #2650: Refactor re.escape to use enumerate().Georg Brandl g.brandl at gmx.net
Sat Mar 26 19:17:19 CET 2011
"Refactor" doesn't sound like it belongs in the 3.1 branch...

Georg

On 25.03.2011 13:27, ezio.melotti wrote:
> 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"
> 
> 
> 
> 
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4