I don't know whether it matters here, but izip from itertools might be interesting in this context.