[Python-Dev] cpython (3.1): #2650: Refactor re.escape to use enumerate().
Ezio Melotti
ezio.melotti at gmail.com
Sun Mar 27 07:59:23 CEST 2011
On 27/03/2011 0.03, Georg Brandl wrote:
> 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.
Hi,
these commits are part of #2650[0].
First, I refactored the existing tests[1] and added a few more tests[2]
to have better coverage. Tests are usually ported to maintenance
branches as well (because they could uncover bugs and also make merging
easier), so I started working on 3.1.
Then I refactored the function[3], and since the refactoring was trivial
and I had extensive tests to make sure that the behavior was unchanged I
included the refactoring in 3.1 too.
FWIW I've been porting most of the commits that I do on 3.2 on 3.1 too
(i.e. I'm considering both of them maintenance branches), and merging 3
branches rather than 2 doesn't make much difference with mercurial.
[0]: http://bugs.python.org/issue2650
[1]: http://hg.python.org/cpython/rev/1402c719b7cf
[2]: http://hg.python.org/cpython/rev/9147f7ed75b3
[3]: http://hg.python.org/cpython/rev/ed02db9921ac
Best Regards,
Ezio Melotti
> Georg
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/ezio.melotti%40gmail.com
>
More information about the Python-Dev
mailing list