Patchwork [1,of,3] revset: rename variable to avoid shadowing with builtin next() function

login
register
mail settings
Submitter timeless
Date May 16, 2016, 9:54 p.m.
Message ID <41e57b118c22aa02c80c.1463435677@gcc2-power8.osuosl.org>
Download mbox | patch
Permalink /patch/15152/
State Accepted
Headers show

Comments

timeless - May 16, 2016, 9:54 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1463434232 0
#      Mon May 16 21:30:32 2016 +0000
# Node ID 41e57b118c22aa02c80c91903a0774c5f8581463
# Parent  5e0077e9c6c0e36a6eb8ab6c12bb8045f07bd2d1
# Available At bb://timeless/mercurial-crew
#              hg pull bb://timeless/mercurial-crew -r 41e57b118c22
revset: rename variable to avoid shadowing with builtin next() function

https://docs.python.org/2/library/functions.html#next
Yuya Nishihara - May 24, 2016, 1:56 p.m.
On Mon, 16 May 2016 21:54:37 +0000, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1463434232 0
> #      Mon May 16 21:30:32 2016 +0000
> # Node ID 41e57b118c22aa02c80c91903a0774c5f8581463
> # Parent  5e0077e9c6c0e36a6eb8ab6c12bb8045f07bd2d1
> # Available At bb://timeless/mercurial-crew
> #              hg pull bb://timeless/mercurial-crew -r 41e57b118c22
> revset: rename variable to avoid shadowing with builtin next() function

The series looks good to me. Pushed to the committed repo, thanks.

Patch

diff -r 5e0077e9c6c0 -r 41e57b118c22 mercurial/revset.py
--- a/mercurial/revset.py	Wed May 11 01:56:59 2016 +0000
+++ b/mercurial/revset.py	Mon May 16 21:30:32 2016 +0000
@@ -2824,11 +2824,11 @@ 
                 val1 = iter1.next()
             if val2 is None:
                 val2 = iter2.next()
-            next = choice(val1, val2)
-            yield next
-            if val1 == next:
+            n = choice(val1, val2)
+            yield n
+            if val1 == n:
                 val1 = None
-            if val2 == next:
+            if val2 == n:
                 val2 = None
     except StopIteration:
         # Flush any remaining values and consume the other one