Message369198
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. |
|
Date |
User |
Action |
Args |
2020-05-18 09:25:04 | Dennis Sweeney | set | recipients:
+ Dennis Sweeney, tim.peters, rhettinger, serhiy.storchaka, bbayles |
2020-05-18 09:25:04 | Dennis Sweeney | set | messageid: <1589793904.74.0.641391073146.issue38938@roundup.psfhosted.org> |
2020-05-18 09:25:04 | Dennis Sweeney | link | issue38938 messages |
2020-05-18 09:25:04 | Dennis Sweeney | create | |
|