Now that BoundedPriorityQueue is quite simple, I don't think you even need it any more. In fact, you can do everything in ```f``` (and I would rename this) as follows:

```
def topIterator(iterator):
    q = []
    for k in iterator:
        if len(q) < num:
            heappush(q, k)
        else:
            heappushpop(q, k)
    yield q
````

Then your ```f2``` (merge function) can look something like

```
def merge(a, b):
    return next(topIterator(a + b))
```

(The ```next``` is there only because topIterator returns a 1 element generator)