-
Notifications
You must be signed in to change notification settings - Fork 0
/
TDifference.py
30 lines (27 loc) · 907 Bytes
/
TDifference.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#----------------------------------------------------------------------
#----------------------------------------------------------------------
#
# td.py
#
'''
td - table difference
Outputs the rows of table 1 that do not occur in table 2, based on keys.
'''
#----------------------------------------------------------------------
from TDiffIntUnion import TDiffIntUnion
from common import *
#----------------------------------------------------------------------
class TDifference (TDiffIntUnion):
USAGE=__doc__
def __init__(self,argv):
TDiffIntUnion.__init__(self,argv)
#---------------------------------------------------------
def go(self):
keys = {}
for row in self.t2:
key = self.makeKey(row, self.kcols2)
keys[key] = 1
for row in self.t1:
key = self.makeKey(row, self.kcols1)
if not keys.has_key(key):
yield row