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


Groups > comp.lang.python > #108487

Re: Pylint prefers list comprehension over filter...

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Terry Reedy <tjreedy@udel.edu>
Newsgroups comp.lang.python
Subject Re: Pylint prefers list comprehension over filter...
Date Tue, 10 May 2016 15:47:07 -0400
Lines 24
Message-ID <mailman.575.1462909641.32212.python-list@python.org> (permalink)
References <572BF2BF.6000000@icloud.com> <1462498631.232041.599637409.25D91C08@webmail.messagingengine.com> <572E3F53.5010703@icloud.com> <ngm5em$jnn$1@ger.gmane.org> <mailman.489.1462671648.32212.python-list@python.org> <e309810a-d9a7-42b9-8e9f-14b8c03ab482@googlegroups.com> <5731f70f$0$1590$c3e8da3$5496439d@news.astraweb.com> <f1ca2718-6178-4fa7-9b67-ca697ae9ed43@googlegroups.com> <ngtdru$cpq$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de 1I5KBeZpzyt6b/o8GU5p4QhILinixCHohPCZaPN+xtKQ==
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; 'builtin': 0.07; 'subject:skip:c 10': 0.07; 'added.': 0.09; 'bool': 0.09; 'extension,': 0.09; 'newly': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'separately': 0.09; 'jan': 0.11; 'argument': 0.15; 'expression.': 0.16; 'iterable)': 0.16; 'lambda': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'unneeded': 0.16; 'wrote:': 0.16; 'hack': 0.18; '(not': 0.20; 'trying': 0.22; 'am,': 0.23; 'split': 0.23; 'header :In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'subject:list': 0.26; 'header:X-Complaints-To:1': 0.26; 'point.': 0.27; 'function': 0.28; 'looks': 0.29; "we're": 0.30; 'checks': 0.30; 'another': 0.32; 'good.': 0.32; 'next': 0.35; 'should': 0.36; 'instead': 0.36; 'created': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'release': 0.37; 'to:addr:python.org': 0.40; 'email addr:gmail.com': 0.62; 'introduction': 0.63; 'received:96': 0.63; 'attention': 0.76; 'subject:over': 0.84; 'received:fios.verizon.net': 0.91
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host pool-96-227-207-81.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0
In-Reply-To <f1ca2718-6178-4fa7-9b67-ca697ae9ed43@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <ngtdru$cpq$1@ger.gmane.org>
X-Mailman-Original-References <572BF2BF.6000000@icloud.com> <1462498631.232041.599637409.25D91C08@webmail.messagingengine.com> <572E3F53.5010703@icloud.com> <ngm5em$jnn$1@ger.gmane.org> <mailman.489.1462671648.32212.python-list@python.org> <e309810a-d9a7-42b9-8e9f-14b8c03ab482@googlegroups.com> <5731f70f$0$1590$c3e8da3$5496439d@news.astraweb.com> <f1ca2718-6178-4fa7-9b67-ca697ae9ed43@googlegroups.com>
Xref csiph.com comp.lang.python:108487

Show key headers only | View raw


On 5/10/2016 11:35 AM, pcmanticore@gmail.com wrote:

> The bad-builtin check is now an extension, so using the first case
> would enable it.

The 'old' (not 'bad') builtin check should include using map instead of 
a comprehension.  The check should also pay attention to whether the 
function argument is an existing function or a one newly created with a 
lambda expression.  "'lambda' in <argument expression>"

I think filter(None, iterable) (== filter(bool, iterable)) should be 
separately flagged as a style point.  It is a hack that became unneeded 
when bool was added.

> Another thing that is going to change with the next release is
> the introduction of tiers. Basically, pylint overwhelms the user
> right now with its enabled checks and we're trying to split these
> into tiers, as seen in the following:

This looks good.

-- 
Terry Jan Reedy

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


Thread

Re: Pylint prefers list comprehension over filter... Terry Reedy <tjreedy@udel.edu> - 2016-05-07 21:40 -0400
  Re: Pylint prefers list comprehension over filter... Claudiu Popa <pcmanticore@gmail.com> - 2016-05-10 06:51 -0700
    Re: Pylint prefers list comprehension over filter... Steven D'Aprano <steve@pearwood.info> - 2016-05-11 00:58 +1000
      Re: Pylint prefers list comprehension over filter... pcmanticore@gmail.com - 2016-05-10 08:35 -0700
        Re: Pylint prefers list comprehension over filter... Terry Reedy <tjreedy@udel.edu> - 2016-05-10 15:47 -0400
        Re: Pylint prefers list comprehension over filter... Chris Angelico <rosuav@gmail.com> - 2016-05-11 06:22 +1000
    Re: Pylint prefers list comprehension over filter... Steven D'Aprano <steve@pearwood.info> - 2016-05-11 01:20 +1000
    Re: Pylint prefers list comprehension over filter... Terry Reedy <tjreedy@udel.edu> - 2016-05-10 15:34 -0400
      Re: Pylint prefers list comprehension over filter... DFS <nospam@dfs.com> - 2016-05-10 16:42 -0400

csiph-web