all subarrays of an array python

import itertools

def allSubArrays(xs):
    n = len(xs)
    indices = list(range(n+1))
    for i,j in itertools.combinations(indices,2):
        yield xs[i:j]

Here is what the above code is Doing:
1. It’s creating a list of indices from 0 to n.
2. It’s creating all combinations of indices from that list.
3. It’s yielding the subarray of xs that corresponds to each combination.