Re: sum for sequences?
- From: Paul Rubin <no.email@xxxxxxxxxxxxxx>
- Date: Wed, 24 Mar 2010 16:19:19 -0700
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.
.
- Follow-Ups:
- Re: sum for sequences?
- From: Steve Howell
- Re: sum for sequences?
- References:
- sum for sequences?
- From: kj
- sum for sequences?
- Prev by Date: Re: Programmatically discovering encoding types supported by codecs module
- Next by Date: Re: the Python Foundation
- Previous by thread: Re: sum for sequences?
- Next by thread: Re: sum for sequences?
- Index(es):