filter function question - list processing in Python
tim_one at email.msn.com
Fri Nov 26 22:48:38 EST 1999
[lobozc at my-deja.com]
> In general, I note that Python has some standard functions operating
> on lists but they are curiously limited.
If you're talking about filter, map and reduce, they were contributed
additions to the language, and Guido has said that accepting the patch was
probably a mistake.
> It is a pity, since these are the functions which reduce line count
> significantly - as well as make programming safer. I wonder what are
> the chances of repeating with lists what Python did with regular
> expressions - copying the functionality from a well tested and popular
In light of the above, there's no chance that more functions of this kind
will be added (that doesn't stop you from writing your own -- it's easy).
OTOH, Haskell-like list comprehensions got a good reception last time they
were discussed, and Greg Ewing has implemented a version of them. I hope
they make it into the base language. A good part of their attraction to
Guido was that they provide a Pythonic way to get the map and filter
functions per se *out* of the language.
Note also that the NumPy extension adds list-processing of the "array
syntax" flavor (flexible N-dimensional slicing, data-parallel SIMD, and
assorted reduction and reshaping functions).
map-without-currying-is-like-thanksgiving-without-turkey-ly y'rs - tim
More information about the Python-list