I have the following procedure:
def myProc(invIndex, keyWord): D={} for i in range(len(keyWord)): if keyWord[i] in invIndex.keys():
D = {} is a dictionary not set.
D = {}
>>> d = {} >>> type(d)
Use D = set():
D = set()
>>> d = set() >>> type(d) >>> d.update({1}) >>> d.add(2) >>> d.update([3,3,3]) >>> d set([1, 2, 3])