Re: finding the intersection of a list of Sets



[Peter Otten]
> >>> sets = map(set, "abc bcd cde".split())
> >>> reduce(set.intersection, sets)
> set(['c'])

Very nice. Here's a refinement:

>>> sets.sort(key=len)
>>> reduce(set.intersection, sets[1:], sets[0])
set(['c'])

.