def integers(blk_size=100):
    x = arange(0, blk_size)
while True:
    yield x
yield -x - 1
x += blk_size

def converge_sum(f, x_strm, eps=1e-05, axis=0):
    total = sum(f(next(x_strm)), axis=axis)
for x_blk in x_strm:
    diff = sum(f(x_blk), axis=axis)
if abs(linalg.norm(diff)) <= eps:
    return total + diff
else:
    total += diff
Infinite Summation in Python