Replace temp lists with iterators
This commit is contained in:
parent
f0a9650174
commit
c8db7b619c
@ -21,6 +21,7 @@
|
|||||||
# relational operations on them.
|
# relational operations on them.
|
||||||
|
|
||||||
import csv
|
import csv
|
||||||
|
from itertools import chain
|
||||||
|
|
||||||
from relational.rtypes import *
|
from relational.rtypes import *
|
||||||
|
|
||||||
@ -171,9 +172,7 @@ class relation (object):
|
|||||||
|
|
||||||
# Create the body
|
# Create the body
|
||||||
for i in self.content:
|
for i in self.content:
|
||||||
row = []
|
row = (i[j] for j in ids)
|
||||||
for j in ids:
|
|
||||||
row.append(i[j])
|
|
||||||
newt.content.add(tuple(row))
|
newt.content.add(tuple(row))
|
||||||
return newt
|
return newt
|
||||||
|
|
||||||
@ -374,10 +373,7 @@ class relation (object):
|
|||||||
match = match and (i[sid[k]] == j[oid[k]])
|
match = match and (i[sid[k]] == j[oid[k]])
|
||||||
|
|
||||||
if match:
|
if match:
|
||||||
item = list(i)
|
item = chain(i, (j[l] for l in noid))
|
||||||
for l in noid:
|
|
||||||
item.append(j[l])
|
|
||||||
|
|
||||||
newt.content.add(tuple(item))
|
newt.content.add(tuple(item))
|
||||||
|
|
||||||
return newt
|
return newt
|
||||||
|
Loading…
Reference in New Issue
Block a user