list problem

Duncan Booth duncan at
Tue Sep 24 15:00:27 CEST 2002

Alex Martelli <aleax at> wrote in 
news:tCYj9.157570$pX1.5675986 at

>> If you are going to use reduce, then you would be better off writing:
>>    import operator
>>    reduce(operator.add, x)
> Maybe (marginally).  But timing things is often a good idea:

Apologies for not being clearer. I actually felt that using operator.add 
read more cleanly than using a lambda. I should have made it more obvious 
that was what I meant. I wouldn't particularly worry which is faster unless 
one was actually proven to be a bottleneck, at which point the OP might 
well find the best way to optimise would be to not end up with nested lists 
in the first place.

Duncan Booth                                             duncan at
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