[Python-Dev] Re: [Python Dev] PEP 309

Raymond Hettinger 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 -
> ala
> > the contents of the exceptions module).
> 
> Well, I think it's a good idea, so I'll formally propose it! Let's
alias
> 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,
but
> it does contemplate a day when we might choose to make such a choice.

-1

map(), filter(), and zip() have already evolved into imap(), ifilter(),
ifilterfalse(), and izip() which we already have in the itertools
module.

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.



Raymond



More information about the Python-Dev mailing list