I am using a slightly modified version of the paired recipe from itertools, which looks like
def pairwise(iterable): "s -> (s0,s1), (s1,s2), (s2, s3), ..." a, b = tee(iterable) next(b, None) return zip(a, b)
Now it turns out that I need to run the code with python 2.5 , where the next () function throws the following exception:
<type 'exceptions.NameError'>: global name 'next' is not defined
Is there a way to use next () with python 2.5? Or how do I need to change a function to make it work?
source share