Tim Peters <t...@python.org> added the comment:
Serhiy, are you aware of heapq.merge()? If not, look it up. And then if you still think merge_sorted() would differ in some way, please spell out how it would differ. Based on what you wrote, you threw an invalid invocation of tee() into the mix for some reason, which heapq.merge() certainly doesn't do. And it's impossible to keep a small bound on memory use when reverse=True if you want it return the same sequence as sorted(... reverse=True). Instead, for heapq.merge(). """ reverse is a boolean value. If set to True, then the input elements are merged as if each comparison were reversed. To achieve behavior similar to sorted(itertools.chain(*iterables), reverse=True), all iterables must be sorted from largest to smallest. """ ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40239> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com