I sometimes need to iterate a list in Python looking at the \"current\" element and the \"next\" element. I have, till now, done so with code like:
for curre
Roll your own!
def pairwise(iterable): it = iter(iterable) a = next(it, None) for b in it: yield (a, b) a = b