"Chris Mellon" <[EMAIL PROTECTED]> writes: > I'm not sure if regular slice notation makes a copy of the list or > not, if it does you can use itertools: > > >>> def sum(list): > ... total = list[0] > ... for v in itertools.islice(list, 1, len(list)): > ... total += v > ... return total > >
import operator def sum(list): it = iter(list) a = it.next() return reduce(operator.add, it, a) -- http://mail.python.org/mailman/listinfo/python-list