import itertools


def proportion_with_neighbours(block_list):
    """
    Calculate the percentage of positive windows that have positive neighbours

    :param list block_list: list of positive windows.
    :returns: Percentage positive windows with positive neighbours.
    """

    no_with_neighbours = 0
    for key, group in itertools.groupby(block_list):
        group = list(group)
        if key and len(group) > 1:
            no_with_neighbours += len(group)

    try:
        return float(no_with_neighbours) / sum(block_list)
    except ZeroDivisionError:
        return 0.