Devan L wrote: > sum(sequence[0] + [1/element for element in sequence[1:]]) > > I think that should work.
That won't work, because it misses the x*y part of the expression (x[n]*x[n+1] + 1/x[n+1], for people who haven't immediately read the grandparent). Personally, I think demanding that it be writable as a sum (or product, or any, or all) is a false standard -- nobody's claimed that these would replace all cases of reduce, just the most common ones. -- http://mail.python.org/mailman/listinfo/python-list