Suppose I have a list
xs = [0,1,2,3]
[some_function(current, next) for current, next in zip(xs, xs[1:])]
I want to iterate over pairs (current, next) of this list. To clarify zip creates list [(0,1), (1,2), (2,3)]
The problem is that if xs is a generator instead of list to achieve this with zip I would need to create a list from it and it is surely not the optimal solution.