A Python dictionary is a mapping between a set of keys and values. The keys() method supports common set operations such as unions, intersections, and differences. Same goes for the items() method. However, that’s not the case with the values() method since the values of a dictionary are not guaranteed to be unique. Based on these notions, we can compare dictionaries and see what they have in common with basic set operations.

a = {
  "x" : 1, 
  "y" : 2, 
  "z" : 3
}

b = {
  "w" : 10, 
  "x" : 11, 
  "y" : 2
}

# find keys in common
a.keys() & b.keys()

# find keys in a that are not in b
## {'y', 'x'}
a.keys() - b.keys()

# find (key, value) pairs in common
## {'z'}
a.items() & b.items()
## {('y', 2)}