|
|
|
|
|
by js2
4490 days ago
|
|
If a document is something not hashable, you can make results a dictionary Huh? Dictionary keys have to be hashable. Oh, maybe you mean coming up with a hashable key for each result, then just taking the values at the end. Something like: # A set of all the documents
all_docs = dict(doc.key, doc for doc in dictionary.all_docs())
# A set of the documents matching `operand`
results = set(doc.key for doc in get_results(operand, dictionary, pfile, force_list=True))
return [all_docs[key] for key in all_docs if key not in results]
(This loses the "sorted" property the author has in the original comments. If that's important, just make all_docs an OrderedDict.) |
|
Thanks for giving the example