externalsort.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:WhooshSearch 作者: rokartnaz 项目源码 文件源码
def imerge(iterables):
        _hpop, _hreplace, _Stop = (heappop, heapreplace, StopIteration)
        h = []
        h_append = h.append
        for itnum, it in enumerate(map(iter, iterables)):
            try:
                nx = it.next
                h_append([nx(), itnum, nx])
            except _Stop:
                pass
        heapify(h)

        while 1:
            try:
                while 1:
                    v, itnum, nx = s = h[0]
                    yield v
                    s[0] = nx()
                    _hreplace(h, s)
            except _Stop:
                _hpop(h)
            except IndexError:
                return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号