This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Generator-support in map() and filter()
Type: enhancement Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: ragnark, tim.peters
Priority: normal Keywords:

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) * (Python committer) 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:03adminsetgithub: 40015
2004-03-09 14:13:35ragnarkcreate