list problem

Duncan Booth duncan at NOSPAMrcp.co.uk
Tue Sep 24 05:07:31 EDT 2002


Thorsten Kampe <thorsten at thorstenkampe.de> wrote in news:amp6i1$7n9bi$1 at ID-
77524.news.dfncis.de:

> * Anthony Tuininga
>> If you have list comprehensions available, use
>>
>> [b for a in x for b in a]
> 
> What about:
> reduce(lambda x, y: x + y, a) ?
> 

If you are going to use reduce, then you would be better off writing:

   import operator
   reduce(operator.add, x)

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list