Comment on Draft Pep ver 4 -- Psuedo Deprecations of Builtins

Andrae Muys amuys at shortech.com.au
Wed May 1 21:05:04 EDT 2002


"Raymond Hettinger" <python at rcn.com> wrote in message news:<aan5hv$aor$1 at bob.news.rcn.net>...
> I no longer think map(), filter(), and reduce() should even be
> psuedo-deprecated,
> but apply(), oct() and hex() are prime candidates.  The input() function
> should
> still be considered for genuine deprecation and deletion, but that reflects
> my
> view of input() as a bug.

Now while I certainly agree with input(), I'm curious what you expect
to use in place of apply()?  When mapping a function to a list of
argument tuples, */** notation now provides a clear, consise
alternative.

[apply(f,args) for args in arglist] 
-> [f(*args) for args in arglist]

Likewise when passing an argument tuple to a list of functions.

However the one case where I haven't been able to see a clean, consise
alternative to apply is matching a list of functions with a list of
argument tuples.  The closest I can get uses zip to create a temporary
list.

map(apply, functionlist, arglist) 
-> [f(*args) for f,args in zip(functionlist, arglist)]

Now please correct me if I'm wrong, but surely there is very little
room for improvement (re. readability, and clear expression of intent)
in the map() used above?

Andrae Muys



More information about the Python-list mailing list