sum for sequences?

Steve Holden steve at holdenweb.com
Wed Mar 24 16:42:52 CET 2010


kj wrote:
> 
> 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)
> 
> ?
> 
> (By "sequence" I'm referring primarily to lists and tuples, and
> excluding strings, since for these there is ''.join()).
> 
Do you mean you want to flatten a list structure? There have been
several discussions about this, which Google will find for you quite easily.

regards
 Steve
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
See PyCon Talks from Atlanta 2010  http://pycon.blip.tv/
Holden Web LLC                 http://www.holdenweb.com/
UPCOMING EVENTS:        http://holdenweb.eventbrite.com/




More information about the Python-list mailing list