Set operations

a = set([1,2,3])
b = set([1,2,4])
a | b  # union
{1, 2, 3, 4}
a & b  # intersections
{1, 2}
a ^ b  # symmetric intersection
{3, 4}
a - b
{3}
b - a
{4}