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


Groups > comp.lang.python > #2737

Re: Is the function filter deprecated?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'bug': 0.02; 'warnings': 0.05; '3.2': 0.07; 'function,': 0.07; 'terry': 0.07; 'python': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'usage.': 0.09; 'pm,': 0.11; 'wrote:': 0.14; 'defined': 0.15; 'expression,': 0.16; 'reedy': 0.16; 'subject:function': 0.16; 'usage': 0.20; 'jan': 0.22; 'code': 0.22; 'header:In-Reply-To:1': 0.22; 'filter': 0.22; '(and': 0.22; 'statement': 0.26; 'changed': 0.27; 'tried': 0.27; 'function': 0.27; 'hi,': 0.29; 'subject:?': 0.29; 'depends': 0.29; 'list': 0.30; 'enabled': 0.31; 'it.': 0.31; 'to:addr:python- list': 0.32; 'source': 0.32; 'header:X-Complaints-To:1': 0.34; 'header:User-Agent:1': 0.35; 'rather': 0.36; 'run': 0.37; 'faster': 0.38; 'but': 0.38; 'no.': 0.38; 'received:org': 0.38; 'unless': 0.38; 'to:addr:python.org': 0.39; 'header:Mime- Version:1': 0.39; 'would': 0.40; 'header:Received:5': 0.40; 'free': 0.62; 'today': 0.70; 'map)': 0.84; 'checker': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: Is the function filter deprecated?
Date Wed, 06 Apr 2011 23:05:54 -0400
References <BANLkTinGwY+jy_uP7Me-NDwDyf8DixPSQQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host rain.gmane.org
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9
In-Reply-To <BANLkTinGwY+jy_uP7Me-NDwDyf8DixPSQQ@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.95.1302145569.9059.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 82.94.164.166
X-Trace 1302145569 news.xs4all.nl 81479 [::ffff:82.94.164.166]:39742
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:2737

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web