extended list comprehensions

F. Jamitzky fxj at hotmail.com
Sun May 26 17:16:31 EDT 2002


It would be great to have something like a list comprehension for the
reduce function. It would work in the same way as the comprehension
for the map function, which is:

[foo(x) for x in xs]      <-is the same as->       map(foo,xs)

and maybe it could be written as:

{y=y+x for x in xs}      <-would be->         reduce(operator.add,xs)

what do the experts think about that ? 

ferdinand



More information about the Python-list mailing list