Kaydet (Commit) dae5db28 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

use closures

üst 5fa09e3e
...@@ -964,7 +964,7 @@ def simple_conjoin(gs): ...@@ -964,7 +964,7 @@ def simple_conjoin(gs):
values = [None] * len(gs) values = [None] * len(gs)
def gen(i, values=values): def gen(i):
if i >= len(gs): if i >= len(gs):
yield values yield values
else: else:
...@@ -989,7 +989,7 @@ def conjoin(gs): ...@@ -989,7 +989,7 @@ def conjoin(gs):
# Do one loop nest at time recursively, until the # of loop nests # Do one loop nest at time recursively, until the # of loop nests
# remaining is divisible by 3. # remaining is divisible by 3.
def gen(i, values=values): def gen(i):
if i >= n: if i >= n:
yield values yield values
...@@ -1007,7 +1007,7 @@ def conjoin(gs): ...@@ -1007,7 +1007,7 @@ def conjoin(gs):
# remain. Don't call directly: this is an internal optimization for # remain. Don't call directly: this is an internal optimization for
# gen's use. # gen's use.
def _gen3(i, values=values): def _gen3(i):
assert i < n and (n-i) % 3 == 0 assert i < n and (n-i) % 3 == 0
ip1, ip2, ip3 = i+1, i+2, i+3 ip1, ip2, ip3 = i+1, i+2, i+3
g, g1, g2 = gs[i : ip3] g, g1, g2 = gs[i : ip3]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment