Replace reduce with listcomprehension?

ssecorp circularfunc at gmail.com
Mon Aug 25 18:08:50 EDT 2008


GvR wants to eliminate all the functional stuff (lambda map reduce
filter) which kind of makes sense for Python, listcomprehensions are
more efficient(at least as implemented inpython) from what i have
gathered and they can express everything map/reduce/filter with
crippled lambdas can.

but what about this:
reduce(lambda x,y:x*y+x,[1,2,3,4,5,6])

how would I express that in a listcomprehension?



More information about the Python-list mailing list