def iterpairs(seq):
 seq_it = iter(seq)
 seq_it_next = iter(seq)
 next(seq_it_next)
 return zip(seq_it, seq_it_next)

def iterpairs ( seq ) : seq_it = iter ( seq ) seq_it_next = iter ( seq ) next ( seq_it_next ) return zip ( seq_it , seq_it_next )
parameters seq : sequence returns iterator returning overlapping pairs of elements examples .