def sparse_iterator(items, num_steps):
    """Sparse iteration over `items`. Every element of the list `items` is
    returned exactly once, but with a different order which can be tweaked by
    changing `num_steps`. The i-th invocation of the iterator roughly returns
    items[i*len(items)//num_steps].
    """
    assert num_steps >= 1
    items = list(items)
    idx = 0
    while items:
        if idx >= len(items):
            idx = idx % len(items)
        yield items[idx]
        items.pop(idx)
        idx += len(items) // num_steps
