Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #2737 > unrolled thread

Re: Is the function filter deprecated?

Started byTerry Reedy <tjreedy@udel.edu>
First post2011-04-06 23:05 -0400
Last post2011-04-06 23:05 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Is the function filter deprecated? Terry Reedy <tjreedy@udel.edu> - 2011-04-06 23:05 -0400

#2737 — Re: Is the function filter deprecated?

FromTerry Reedy <tjreedy@udel.edu>
Date2011-04-06 23:05 -0400
SubjectRe: Is the function filter deprecated?
Message-ID<mailman.95.1302145569.9059.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web