Python dict.keys(): Using set operators on dictionary keys

Python dict.keys(): Using set operators on dictionary keys

Want the unique keys from two Python dicts? dict.keys() returns a set-like object, supporting set operators:

d1 = {'a':10, 'b':20, 'c':30}
d2 = {'b':22, 'c':33, 'd':44}
d3 = {'a':10}
d1.keys() | d2.keys()   # {'b', 'c', 'a', 'd'}
d3.keys() < d1.keys()   # True