Python has those nice operator overloads for sets.
Comparison for subset/superset, - for difference and the clever use of bitwise operators. Makes sense to think of | as union, & as intersection and ^ as symmetric difference where integers are defined as sets of indexed bits.