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)
评论列表
文章目录