Is the function filter deprecated?

Emile van Sebille emile at fenx.com
Thu Apr 7 01:37:25 CEST 2011


On 4/6/2011 4:20 PM Jabba Laci said...
> Hi,
>
> I tried Pylint today and it gave me a warning for the function
> "filter". Is it deprecated?


This post from Guido written in 2005 with an undated update would seem 
to indicate No.

http://www.artima.com/weblogs/viewpost.jsp?thread=98196



> Is the usage of list comprehensions encouraged?

Yes -- it's considered more pythonic in general, but I see generators 
often (over?) deployed as well due in part I think to their lazy evaluation.


Emile


> The transformation is not complicated, by the way:
> replace "filter( func, seq )" with "[ x for x in seq if func(x) ]" .
>
> Thanks,
>
> Laszlo





More information about the Python-list mailing list