externalsort.py 文件源码

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

项目:WhooshSearch 作者: rokartnaz 项目源码 文件源码
def sort(items, maxsize=100000, tempdir=None, maxfiles=128):
    """Sorts the given items using an external merge sort.

    :param tempdir: the path of a directory to use for temporary file
        storage. The default is to use the system's temp directory.
    :param maxsize: the maximum number of items to keep in memory at once.
    :param maxfiles: maximum number of files to open at once.
    """

    p = SortingPool(maxsize=maxsize, tempdir=tempdir)
    for item in items:
        p.add(item)
    return p.items(maxfiles=maxfiles)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号