def rgp seq for in izip seq seq n-1 yield

1
2
3
def rgp(seq, n):
for i in izip(seq[::n], seq[n-1::n]):
yield i