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


Groups > comp.lang.python > #108297

Re: Pylint prefers list comprehension over filter...

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Pylint prefers list comprehension over filter...
Date Sun, 8 May 2016 07:22:31 +1000
Lines 31
Message-ID <mailman.474.1462656153.32212.python-list@python.org> (permalink)
References <572BF2BF.6000000@icloud.com> <1462498631.232041.599637409.25D91C08@webmail.messagingengine.com> <572E3F53.5010703@icloud.com> <CAPTjJmo29JkU=Fyoe2oMk5q5M9pxTF8aOki0Yx989W163k9Qhg@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de t7wkyDQZtMjHfhtpPXlsPw+VmED7tKgbTvKGat80ikiQ==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.023
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'reject': 0.05; 'subject:skip:c 10': 0.07; 'cc:addr:python-list': 0.09; 'output': 0.13; 'thu,': 0.15; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'happy.': 0.16; "isn't.": 0.16; 'pythonic': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'url:pep-0008': 0.16; 'wrote:': 0.16; "shouldn't": 0.18; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'first,': 0.20; 'stephen': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'subject:list': 0.26; 'message-id:@mail.gmail.com': 0.27; 'correct': 0.28; 'concern': 0.29; 'pep': 0.29; 'url:peps': 0.29; "i'm": 0.30; 'code': 0.30; '(i.e.,': 0.30; 'options': 0.33; 'url:python': 0.33; 'purposes,': 0.33; 'list': 0.34; 'received:google.com': 0.35; 'filter': 0.35; 'url:dev': 0.35; 'but': 0.36; 'url:org': 0.36; 'possible.': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'hiring': 0.37; 'received:209': 0.38; 'wrong': 0.38; 'sure': 0.39; 'does': 0.39; 'default': 0.61; 'engine': 0.62; 'treat': 0.72; 'yourself': 0.73; 'score': 0.76; 'hand': 0.82; '"yes,': 0.84; 'chrisa': 0.84; 'score.': 0.84; 'subject:over': 0.84; 'to:none': 0.91; 'ultimate': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc; bh=nra3I98IHYXpZT2+odM8QP7+lPmBv+mwE/lgLGFn+GY=; b=KLtkfvW+RFg2mRN575YfoeI1Tn2nCaBwgCZYg4xu38RnQRCTrXpMKwznTYnExqCxZl uQL50r82T2m+p6RQPCj//Hi6B0COl4J/Ak0zHnYkwC7NcPalAOGSEDg644yoqI+JlJIN Rgu6ArJ6m2C5gO8gEmsEHqD9lzV0M3BrVGx5vFAJuyDaxUQsIXyZfskSIkDEXzbdvOpV A+2sYcyaT8EDTAHaXGwoiRXFfe1J0iqRcm0PW75rtPvvYV3VocOiykJ1+0elfr9c1HD5 wWMwmLl0ZeTkddScD5XpnuTgdFuiqvB8SobAJrYDPHMnqvvi3RDsZh3gzyVYYauuOhig gYvQ==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=nra3I98IHYXpZT2+odM8QP7+lPmBv+mwE/lgLGFn+GY=; b=dqrXk9Zc32SzhF6XulJxEVYoL21SsCuW2Am8WEzX67zAT8c1R5MaNu5AgZCyejR6zT 66H1ReqiynfIIm5/kM9NKrrwyy5BTSlb45GXsjsX1LT1J0+VGgb4OfsHMwubihNcHGF4 q/vbHX2QOrid3xeUmsJB/jSHDzZokyTK0Mf8DONQ5z5HjZgYHynqTxUY1zMu9SemEz7t +euZ8/Ty9YxKLRtmnMFZSE5xsIcpqiZ84Mf0rqwwRKBIzdqEpEYguwMo0PcxRLKQ5ssH MGAaDGsoLBJmXBRk8/cCLpXG7eJKlXZDUVewqZrY0Xod0Kt1Wc1c3tmSNRkM8mlpc807 3yzQ==
X-Gm-Message-State AOPr4FUgLUGoyM0dQPBAwhERR/J9S/jA+YBwLX0rd9hSGGepYxqW9/vJq+5UJjbKlwDtR7O0h7AL9Iw9qAr0Dg==
X-Received by 10.25.158.149 with SMTP id h143mr12164993lfe.135.1462656151175; Sat, 07 May 2016 14:22:31 -0700 (PDT)
In-Reply-To <572E3F53.5010703@icloud.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 <CAPTjJmo29JkU=Fyoe2oMk5q5M9pxTF8aOki0Yx989W163k9Qhg@mail.gmail.com>
X-Mailman-Original-References <572BF2BF.6000000@icloud.com> <1462498631.232041.599637409.25D91C08@webmail.messagingengine.com> <572E3F53.5010703@icloud.com>
Xref csiph.com comp.lang.python:108297

Show key headers only | View raw


On Sun, May 8, 2016 at 5:17 AM, Christopher Reimer
<christopher_reimer@icloud.com> wrote:
> On 5/5/2016 6:37 PM, Stephen Hansen wrote:
>>
>> On Thu, May 5, 2016, at 06:26 PM, Christopher Reimer wrote:
>>>
>>> Which is one is correct (Pythonic)? Or does it matter?
>>
>> First, pylint is somewhat opinionated, and its default options shouldn't
>> be taken as gospel. There's no correct: filter is fine.
>
>
> Since the code I'm working on is resume fodder (i.e., "Yes, I code in
> Python! Check out my chess engine code on GitHub!"), I want it to be as
> Pythonic and PEP8-compliant as possible. That includes scoring 10/10 with
> pylint. Never know when an asshat hiring manager would reject my resume out
> of hand because my code fell short with pylint.
>
> For my purposes, I'm using the list comprehension over filter to keep pylint
> happy.

Wrong thinking. Make it Pythonic - but don't concern yourself with
pylint's final score. Read pylint's output and learn from it, but
don't treat a 10/10 score as the ultimate in ratings, because it just
isn't.

Also, be sure you read this part of PEP 8:

https://www.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds

ChrisA

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


Thread

Re: Pylint prefers list comprehension over filter... Chris Angelico <rosuav@gmail.com> - 2016-05-08 07:22 +1000

csiph-web