f | def joinseq(*seq): | f | def joinseq(*seq): |
n | iterators = [iter(sequence) for sequence in seq] | n | iterators = [iter(seq_) for seq_ in seq] |
| value = [next(i) for i in iterators] | | val = [next(i) for i in iterators] |
| while True: | | while True: |
n | min_item = min(value) | n | min_item = min(val) |
| yield min_item | | yield min_item |
t | index = value.index(min_item) | t | idx = val.index(min_item) |
| value[index] = next(iterators[index], None) | | val[idx] = next(iterators[idx], None) |
| if value[index] == None: | | if val[idx] == None: |
| value.pop(index) | | val.pop(idx) |
| iterators.pop(index) | | iterators.pop(idx) |
| if value == []: | | if val == []: |
| break | | break |