Re: sum for sequences?



kj <no.email@xxxxxxxxxxx> writes:
Is there a sequence-oriented equivalent to the sum built-in? E.g.:
seq_sum(((1, 2), (5, 6))) --> (1, 2) + (5, 6) --> (1, 2, 5, 6)

use itertools.chain for this. A few people have mentioned that sum will
also work, but I think for that purpose it could have O(n**2)
complexity.
.