def _cumulative_sum(xs):
 cumsum = 0
 for x in xs:
  cumsum += x
  (yield cumsum)

def _cumulative_sum ( xs ) : cumsum = 0 for x in xs : cumsum += x ( yield cumsum )
return a list where each element is the sum up to that point .