I want to access overlapping pairs of adjacent values in a generator.
If it was a list, I could use
a = [5, 7, 11, 4, 5]
for v, w in zip(a[:-1], a[1:]):
print [v, w]
Which is from this question.
But when I try to do the same with a generator, I get the error
TypeError: 'generator' object is not subscriptable
Is there a way to do this for generators?