A few hours back I stumbled into a problem where I had to perform a lookahead of n elements in a list to do some calculations. The first thought: Just take the current index and get all elements until i+n. I started writing.. for i in range(len(iterable)): ---- SNAP ---- Stop. This is awfully unpythonic.… Continue reading N-wise Iteration in Python