Those methods of computing partial sums seem to be O(n^2) or worse.
What's wrong with an ordinary loop?

for i in xrange(1, len(l)):
    l[i] += l[i - 1]

And as for the list of objects:

ll = [l[i - 1].method(l[i]) for i in xrange(1, len(l))] + l[-1]

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to