filter and map / deprecated?

Raymond Hettinger python at rcn.com
Thu Dec 18 11:10:16 EST 2003


> I read in PEP 279 the following comment by GvR:
> 
>     "filter and map should die and be subsumed into list 
>     comprehensions, not grow more variants."
> 
> Actually, I am using 'filter' and 'map' a lot in my scripts
> (not really because they are necessary, but more because I
> like them). Should I avoid the usage of 'filter' and 'map'
> in the future? The above comment by GvR makes me a little 
> bit afraid that they will become deprecated one day and that
> I will have to change many of my scripts then.

Until Py3.0, we are shying away from deprecating things.
apply(), buffer(), coerce(), and intern() were moved to a
separate page in the docs for obsolete or non-essential stuff
but there are no deprecations.

The itertools variants of filter and map are proving to be
popular and will likely be around for a long time.  I suggest
using them instead of the builtins since they are memory friendly
and scale-up nicely.


Raymond Hettinger




More information about the Python-list mailing list