def accumulate(iterable): " Super simpel 'accumulate' implementation. " total = 0 for item in iterable: total += item yield total