Very simple 2-element sliding window can be implemented as follows
for i, curr in enumerate(arr[1:]): prev = arr[i] ...