brainstorm/utils.py
def convert_to_nested_indices(container, start_idx=None):
    """Return nested lists of indices with same structure as container."""
    if start_idx is None:
        start_idx = [0]
    for i in container:
        if isinstance(i, (list, tuple)):
            yield list(convert_to_nested_indices(i, start_idx))
        else:
            yield start_idx[0]
            start_idx[0] += 1
Return nested lists of indices with same structure as container.
Return nested lists of indices with same structure as container.
Return nested lists of indices with same structure as container .
def convert_to_nested_indices(container, start_idx=None):
    if start_idx is None:
        start_idx = [0]
    for i in container:
        if isinstance(i, (list, tuple)):
            yield list(convert_to_nested_indices(i, start_idx))
        else:
            yield start_idx[0]
            start_idx[0] += 1
def convert_to_nested_indices ( container , start_idx = None ) : if start_idx is None : start_idx = [ 0 ] for i in container : if isinstance ( i , ( list , tuple ) ) : yield list ( convert_to_nested_indices ( i , start_idx ) ) else : yield start_idx [ 0 ] start_idx [ 0 ] += 1
Return nested lists of indices with same structure as container.
Return nested lists of indices with same structure as container .
"""Return nested lists of indices with same structure as container."""
container
start_idx