Question regarding a recent article on

Peter Hansen peter at
Thu Mar 20 14:34:48 CET 2003

Ben S wrote:
> Are there any good tutorials of examples of list comprehension use? In
> particular, I'm interested in how to replicate the functionality of
> reduce? Map and filter seem easy to do, though.

Doesn't reduce return a non-list (or at least, isn't it the case that 
it doesn't necessarily return a list the way map and filter do)?

An *abuse* of a list comprehension, or a list comprehension in 
conjuction with something else, could probably replicate reduce(),
but why bother?  reduce() isn't really like map and filter.


More information about the Python-list mailing list