Comments on Version 2, Draft Pep for Deprecating Builtins

holger krekel pyth at devel.trillke.net
Mon Apr 29 08:15:12 EDT 2002


> Rationale
> 
>     There are separate motivations for each function.  One motivation in
>     common is that the number of total built-ins should be as small as
>     possible to limit the amount of "core language" one needs to know in
> order
>     to read code that is not module specific.

This won't change the fact that some people really like to work with 
filter, lambda and friends. They will probably include the import
statement for their examples. 

>     The functionals (map, filter, and reduce) had greater importance prior
> to
>     the introduction of list comprehensions which are now the preferred (and
>     more readable) approach.  

Is 

    map(func, list)

really less readable than

    [ func(x) for x in list]

? If we voted on this are you sure 50% would say that the
list-comprehension is more readable and more easily understandable?
My take:

- map expresses without noise that func is applied to the list elements
- map uses no special syntax (like the 'for' loop without ':')
- map is shorter

Btw, what is the best/shortest way to express 'filter' and 'reduce' with 
list comprehensions?

regards,

    holger





More information about the Python-list mailing list