Dennis Sweeney <sweeney.dennis...@gmail.com> added the comment:

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.

----------
Added file: https://bugs.python.org/file49170/winners.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38938>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to