This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Dennis Sweeney
Recipients Dennis Sweeney, bbayles, rhettinger, serhiy.storchaka, tim.peters
Date 2020-05-18.09:25:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1589793904.74.0.641391073146.issue38938@roundup.psfhosted.org>
In-reply-to
Content
I mostly like new_merge.py too, especially the dynamic reduction of the tree.

However, it looks like ``list(merge([2],[1],[1]))`` currently fails, and I think what's missing is the following in the sibling-promotion:

+             if sibling.left is not None:
+                 sibling.left.parent = sibling.right.parent = parent

Also for what it's worth, I think both appearances of "c1 if c1.value < c2.value else c2" should become "c2 if c2.value < c1.value else c1" for stability. 

I've attached winners.py, which is similar to new_merge.py, but replaces the "while node.left is not None: node = node.source" traversal with a single "node = node.leaf" call and adds a fast yield-from for the last iterator. I don't think it's much more complex either.
History
Date User Action Args
2020-05-18 09:25:04Dennis Sweeneysetrecipients: + Dennis Sweeney, tim.peters, rhettinger, serhiy.storchaka, bbayles
2020-05-18 09:25:04Dennis Sweeneysetmessageid: <1589793904.74.0.641391073146.issue38938@roundup.psfhosted.org>
2020-05-18 09:25:04Dennis Sweeneylinkissue38938 messages
2020-05-18 09:25:04Dennis Sweeneycreate