[Python-Dev] Re: [Python Dev] PEP 309
python at rcn.com
Thu Mar 3 22:22:40 CET 2005
> Nick Coghlan writes:
> > I'm actually half-tempted to suggest that [map, filter and reduce]
> should be
> > aliased in the functional module for 2.5 (in addition to being in
> builtins -
> > the contents of the exceptions module).
> Well, I think it's a good idea, so I'll formally propose it! Let's
> map, filter, and reduce into the functional module now that it exists.
> This doesn't create any need or pressure to remove these as builtins,
> it does contemplate a day when we might choose to make such a choice.
map(), filter(), and zip() have already evolved into imap(), ifilter(),
ifilterfalse(), and izip() which we already have in the itertools
Introducing extra copies of the old list/builtin versions doesn't
improve anyone's life. It adds bloat without adding new functionality.
Also, someone else (Alex maybe) was proposing another module for
functions that consume an iterator and return a scalar (like sum(),
min(), max(), etc). The idea was to make some of the itertools recipes
into a module (any, all, no, take, etc). If that happens, then there
would be yet another possible home for reduce.
If you want to add something new and useful to the functional module,
try a compose() function.
More information about the Python-Dev