Replace reduce with listcomprehension?
Luis M. González
luismgz at gmail.com
Mon Aug 25 18:33:25 EDT 2008
Actually, GvR announced that "lambda, filter and map will stay (the
latter two with small changes, returning iterators instead of lists).
Only reduce will be removed from the 3.0 standard library. You can
import it from functools."
Check the full article here: http://www.artima.com/weblogs/viewpost.jsp?thread=98196
Luis
On Aug 25, 7:08 pm, ssecorp <circularf... at gmail.com> wrote:
> 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