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

Georg Brandl g.brandl at gmx.net
Sat Mar 26 23:03:13 CET 2011


On 26.03.2011 20:19, "Martin v. Löwis" wrote:
> Am 26.03.2011 20:00, schrieb Terry Reedy:
>> On 3/26/2011 2:17 PM, Georg Brandl wrote:
>>> "Refactor" doesn't sound like it belongs in the 3.1 branch...
>> 
>>>> -        for i in range(len(pattern)):
>>>> -            c = pattern[i]
>>>> +        for i, c in enumerate(pattern):
>> 
>> I would call thin 'Replace obsolete idiom in' rather than 'Refactor'.
>> So are you criticizing the replacement or the mislabeling?
> 
> No - I believe he is critizing that a stylistic change is done
> in a maintenance branch. It's not a bug fix, AFAICT, so it should not
> have been done.

Exactly, and two changesets before that there was another commit
"Refactor the tests for re.escape" that was by far larger than this one,
and not as easily reviewed as this one.

In the end, this kind of change in a bugfix branch has zero gain, but
a nonzero risk of gratuitous breakage.  If it is necessary for future
fixes or ease of merging bugfixes, I'd at least expect a note of that
in the commit message justifying the breach of policy for a
barely-maintenance branch.

Georg



More information about the Python-Dev mailing list