In [3]:
import matplotlib.pyplot as plt
import numpy as np
#import xxhash
L = np.array([1,2,3,4,5,6,7,8,9,0,1,2])

In [13]:
def getAllWindows(L,L2=None,lenght=3):
    if L2 is None:
        L2 = L[:-1]
    if L.size<lenght:
        if L2.size<lenght:
            return []
        return getAllWindows(L2,L2[:-1],lenght)
    if L.size>lenght:
      return getAllWindows(L[1:],L2,lenght)
    return [L]+getAllWindows(L[1:],L2,lenght)

In [14]:
windows = getAllWindows(L,lenght=3)
windows


Out[14]:
[array([0, 1, 2]),
 array([9, 0, 1]),
 array([8, 9, 0]),
 array([7, 8, 9]),
 array([6, 7, 8]),
 array([5, 6, 7]),
 array([4, 5, 6]),
 array([3, 4, 5]),
 array([2, 3, 4]),
 array([1, 2, 3])]

In [ ]: