[Python-ideas] Minimal built-ins (+ tiny doc suggestion)
Nick Coghlan
ncoghlan at gmail.com
Fri May 25 10:28:28 CEST 2012
On Fri, May 25, 2012 at 5:53 PM, Mark Summerfield <list at qtrac.plus.com> wrote:
> Hi,
>
> Built-ins:
>
> In an effort to keep the core language as small as possible (to keep it
> "brain sized":-) would it be reasonable to deprecate filter() and map()
> and to move them to the standard library as happened with reduce()?
> After all, don't people mostly use list comprehensions and generator
> expressions for these nowadays?
I'd personally agree with filter() moving, but "map(str, seq)" still
beats "(str(x) for x in seq)" by a substantial margin for me when it
comes to quickly and cleanly encapsulating a common idiom such that it
is easier both to read *and* write.
The basic problem is that the answer to your question is "no" - for
preexisting functions, a lot of people still use filter() and map(),
with the comprehension forms reigning supreme only when someone would
have had to otherwise use a lambda expression.
We won the argument for moving reduce() to functools because it's such
a pain to use correctly that it clearly qualified as an attractive
nuisance.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list