msort.py 文件源码

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

项目:acris 作者: Acrisel 项目源码 文件源码
def merge(key=None, *iterables):
    # based on code posted by Scott David Daniels in c.l.p.
    # http://groups.google.com/group/comp.lang.python/msg/484f01f1ea3c832d

    if key is None:
        keyed_iterables = iterables
    else:
        keyed_iterables = [(Keyed(key(obj), obj) for obj in iterable)
                            for iterable in iterables]
    for element in heapq.merge(*keyed_iterables):
        yield element.obj
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号