I want to merge two lists in python, with the lists being of different lengths, so that the elements of the shorter list are as equally spaced within the final list as possi
If we modify @Jon's answer like this
from itertools import count import heapq [x[1] for x in heapq.merge(izip(count(0, len(b)), a), izip(count(0, len(a)), b))]
It doesn't matter which of a/b is longest
a
b