Using functional tools

Alex Martelli aleax at aleax.it
Wed May 8 02:49:57 EDT 2002


Andrae Muys wrote:
        ...
>> Or, if the OP's religion forbids 'fors' or 'whiles' under any
>> circumstances:
        ...
> Alternatively you can use the "obsolete" apply() and simplify the code
> substantially.

Not without 'for' or 'while' under the covers (you hid yours in your
functions xmap and xextend).  List comprehensions are way simpler.

If you're going to code your own supporting functions anyway, it's
clearly inappropriate to have 'apply' as a builtin, since, should you
ever want it, it's by far the simplest of auxiliary functions to
code yourself -- "def apply(f,a,k): return f(*a,**k)".


Alex




More information about the Python-list mailing list