I needed to compare 2 dictionaries to find the set of keys in one dictionary which was not in the other.
I know that Python set objects support:
set3=set1-set2
but I can't do:
dict3=dict1-dict2
or:
missingKeys=dict1.keys()-dict2.keys()
(I was a little surprised by the last point, because in Java the keys are a Set object.) One solution is:
missingKeys=set(dict1.keys())-set(dict2.keys())
is there a better or more concise way to do this?