On 4/6/2011 7:20 PM, Jabba Laci wrote:
Hi,

I tried Pylint today and it gave me a warning for the function
"filter".

That is a bug in PyLint. Do not take any code checker as gospel truth.

Is it deprecated?

No. One can look in the source code for a deprecation warning statement or run 3.2 with deprecation warnings enabled and call it.

In Python 3, filter (and map) were changed to return iterables rather than lists.

> Is the usage of list comprehensions encouraged?

Depends on the person and usage. If you already have the filter function defined filter(f,seq) is easier and to me clearer. If you do not have a filter function, but only an expression, and would not use it again, then (x for x in seq if expr) is faster and to me easier and clearer than filter(lambda x: expr, seq)

Feel free to take your pick unless part of a group with code guidelines.

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to