Issue 912738: Generator-support in map() and filter() (original) (raw)
Issue912738
Created on 2004-03-09 14:13 by ragnark, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (2) | ||
---|---|---|
msg54112 - (view) | Author: Ragnar Kjørstad (ragnark) | Date: 2004-03-09 14:13 |
The current implementation of map() and filter() returns a list when executed on any iterator, including generators. However, it may be very useful to map and filter the output from generators without having to generate all the data and allocate memory for it. I would propose for map() and filter() to return a generator-object instead of a list when the input-argument is a generator. | ||
msg54113 - (view) | Author: Tim Peters (tim.peters) * ![]() |
Date: 2004-03-09 20:11 |
Logged In: YES user_id=31435 It's (far) too late to change the signature of map() and filter (). Look in the itertools module instead: its ifilter() and imap () functions already do what you asked for (and more). |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:03 | admin | set | github: 40015 |
2004-03-09 14:13:35 | ragnark | create |