Here is a seemingly simple problem: given a list of iterators that yield sequences of integers in ascending order, write a concise generator that yields only the integers th
import heapq, itertools def intersect(*its): for key, values in itertools.groupby(heapq.merge(*its)): if len(list(values)) == len(its): yield key >>> list(intersect(*postings)) [100, 322]