Python: Return all Indices of every occurrence of a Sub List within a Main List
Question: I have a Main List and a Sub List and I want to locate the indices of every
occurrence of the Sub List that are found in the Main List, in this example, I
want the following list of indices returned.

    
    
    >>> main_list = [1,2,3,4,4,4,1,2,3,4,4,4]
    >>> sub_list = [4,4,4]
    
    >>> function(main_list, sub_list)
    >>> [3,9]
    

Ideally, the function should also ignore fragments of the sub_list, in this
case [4,4] would be ignored. Also, I expect the elements to all be single
digit integers. Here is a second example, for clarity:

    
    
    >>> main_list = [9,8,7,5,5,5,5,5,4,3,2,5,5,5,5,5,1,1,1,5,5,5,5,5]
    >>> sub_list = [5,5,5,5,5]
    
    >>> function(main_list, sub_list)
    >>> [3,11,19]
    


Answer: Maybe using strings is the way to go?

    
    
    import re
    original = ''.join([str(x) for x in main_list])
    matching = ''.join([str(x) for x in sub_list])
    starts = [match.start() for match in re.finditer(re.escape(matching), original)]
    

The only problem with this one is that it doesn't count for overlapping values

