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...
> 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.
> 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.
> The transformation is not complicated, by the way:
> replace "filter( func, seq )" with "[ x for x in seq if func(x) ]" .
More information about the Python-list