Re: finding the intersection of a list of Sets
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: finding the intersection of a list of Sets

From: Raymond Hettinger <python@rcn.com>
Date: Tue Jan 31 2006 - 18:34:34 CET

That should have been:

>>> sets.sort(key=len)
>>> reduce(set.intersection, sets)

The only refinement was the pre-sort based on set length.
Received on Tue Feb 7 20:24:50 2006