[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accumulator



Guy Steele wrote:
> I conjecture that if Python allowed you to write
> 
> >>> x = reduce(+, range(2,20))
> 
> then this idiom would be somewhat more attractive.

footnote: python's "operator" module provides functional equivalents
for all operands:

    >>> from operator import add
    >>> x = reduce(add, range(2,20))

</F>