[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'])

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to