[Python-iterators] While we're at it...
Thomas Wouters
thomas at xs4all.net
Fri Jun 29 18:14:57 EDT 2001
On Fri, Jun 29, 2001 at 02:34:44PM -0700, David Eppstein wrote:
> In article <mailman.993846826.12787.python-list at python.org>,
> "Tim Peters" <tim.one at home.com> wrote:
> > - The following functions were generalized to work nicely with iterator
> > arguments:
> > map(), filter(), reduce(), zip()
> Is there a PEP for this? It doesn't seem to be in 234.
It's one of those things that are so obvious, they aren't PEPed :)
> Can I assume that "work nicely" means they act like simple generators in
> yielding partial results even when their inputs are infinite sequences?
This change was part of the Iterator PEP, not the Generator PEP. They aren't
modified to return generators, they are just generalized to work with
iterators, and hence accept iterators, as well as sequences with and without
their own iterator, as arguments. After all, those functions are just
glorified for loops.
--
Thomas Wouters <thomas at xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
More information about the Python-list
mailing list