
July 23, 2009
7:04 a.m.
Andy Kish schrieb:
Instead you have to do something contorted like:
if len(sets) == 0: set_intersection = set() else: sets_i = iter(sets) set_intersection = sets_i.next() for s in sets: set_intersection &= s
Note that a simple ``reduce(operator.and_, sets)`` would suffice for > 1 set. Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out.