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


Groups > comp.lang.python > #108301

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:46:17 +1000
Lines 36
Message-ID <mailman.477.1462657579.32212.python-list@python.org> (permalink)
References <572BF2BF.6000000@icloud.com> <1462498631.232041.599637409.25D91C08@webmail.messagingengine.com> <572E3F53.5010703@icloud.com> <1462656950.727725.601099753.30D90B95@webmail.messagingengine.com> <CAPTjJmqBCM1HT3wCV1tfTMMS9gt5pf-idx4jNV03YmPB2mS-RA@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de hQJvugFSlLPJUF4xwCi8HQnIEbLBEGv+cxLPH+B4uoWA==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'reject': 0.05; 'subject:skip:c 10': 0.07; 'tool,': 0.07; 'cc:addr:python-list': 0.09; 'encode': 0.09; 'matched': 0.09; 'thu,': 0.15; '2016': 0.16; '7:35': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'happy.': 0.16; 'pep8': 0.16; 'pythonic': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'abuse': 0.18; 'say,': 0.18; "shouldn't": 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'first,': 0.20; '(the': 0.22; 'disabled': 0.22; 'logical': 0.22; 'stephen': 0.22; 'am,': 0.23; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; 'subject:list': 0.26; 'message-id:@mail.gmail.com': 0.27; 'correct': 0.28; 'fine': 0.28; 'agreed.': 0.29; 'document,': 0.29; 'mind,': 0.29; "i'm": 0.30; 'code': 0.30; '(i.e.,': 0.30; 'received:209.85.215.46': 0.30; "i'd": 0.31; "can't": 0.32; 'especially': 0.32; 'run': 0.33; 'options': 0.33; 'purposes,': 0.33; 'list': 0.34; 'received:google.com': 0.35; 'next': 0.35; 'filter': 0.35; 'step': 0.36; 'but': 0.36; 'possible.': 0.36; 'tool': 0.36; 'received:209.85': 0.36; 'tools,': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'hiring': 0.37; 'received:209': 0.38; 'wrong': 0.38; 'mean': 0.38; 'does': 0.39; 'some': 0.40; 'your': 0.60; 'default': 0.61; 'engine': 0.62; 'times': 0.63; 'you.': 0.64; 'useful.': 0.72; 'incredibly': 0.76; 'score': 0.76; 'hand': 0.82; '"yes,': 0.84; 'chrisa': 0.84; 'mandatory.': 0.84; 'subject:over': 0.84; 'to:none': 0.91
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=UtYqVHgDahB8TDQwLqwqCzku8WskOFYVJ+WVSKK7DA0=; b=nfoc7AOFBdCX8CI5GQa0zXgaeMhRwwL5708JyoCYGAj3t7ro2Jay2w5j6XC9zdiIi/ xokfxdL/2ua6gTARCFPuvXzZ0ys4CFrOxq5/yiuFC6gG3tFa+yF5NWpvGah3Egl9tosE LR/SBTnL94OSwZ+qQtiLzXNEixBO1bAKZe3FkMdVCPuvGrQPJEKZ5gxwKqkDSvM0mb9Q Xj08f62g0uhc8fWO0bdP4uw24IVc30Xx3O/yb17kvF0MYlX9q53fi4uh38xAh3+qVoLS RClQ/4CvtnBr7eIMvhsRsZdBzYzYzd3eFl44nCoRBxlOqTsavSrVKQTSslNFO8lQQLHJ PHrQ==
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=UtYqVHgDahB8TDQwLqwqCzku8WskOFYVJ+WVSKK7DA0=; b=Z3cDyptuFcdcaH2CvStAvN7zHJCF9L/N1rKbV6kSLFxL+5Rwc4dBKX8WV5kLJVlyLV lwoAYpXbM7gkQSwnMzueHtomkoWvO5loB025riQKJMcFasYNsK15j/oamB+xjHYBkw1n 9jUuoACGmle9s5OdxPkijUY/xsdw/BWTQGowXTL33agJuvG7e7Gr54oufkpt4Lh9V4MW Gup8Av+af5y9/pWTN9plfTUM4UYrt/IlBG/ldeBFHt76tLRhisAnqjD1tLKuojG638te lex1Tdd/Fyuno7FsHeMwb5GTYa7iLp8lm1GhcSyrVubZrmkULipk6mM+qdidqBZo6B38 Q/Ww==
X-Gm-Message-State AOPr4FUEUNntS7vpkjOlg99JRAd573XXJWomvsZfHHEB4kH9VBsENva5aWsJecY37UIOYYbgK9uI73vsQN0bZg==
X-Received by 10.25.79.12 with SMTP id d12mr12242028lfb.68.1462657577526; Sat, 07 May 2016 14:46:17 -0700 (PDT)
In-Reply-To <1462656950.727725.601099753.30D90B95@webmail.messagingengine.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 <CAPTjJmqBCM1HT3wCV1tfTMMS9gt5pf-idx4jNV03YmPB2mS-RA@mail.gmail.com>
X-Mailman-Original-References <572BF2BF.6000000@icloud.com> <1462498631.232041.599637409.25D91C08@webmail.messagingengine.com> <572E3F53.5010703@icloud.com> <1462656950.727725.601099753.30D90B95@webmail.messagingengine.com>
Xref csiph.com comp.lang.python:108301

Show key headers only | View raw


On Sun, May 8, 2016 at 7:35 AM, Stephen Hansen <me@ixokai.io> wrote:
> On Sat, May 7, 2016, at 12:17 PM, Christopher Reimer 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.
>
> Bear in mind, when I say, "Pylint is opinionated", I mean the tool --
> especially in its default configuration -- has its own opinion of what
> is good style, and *I think its wrong on a number of points*.

Agreed. The OP has already run into this, and disabled some checks;
the logical next step is to stop treating a 10/10 score as mandatory.

> Its fine to use, but I'd read over PEP8 (the document, not the tool) and
> apply style guide recommendations thoughtfully, not mechanically.

Definitely. It's times like this that I'm really annoyed by the abuse
of the name "pep8" to mean the tool, especially since it's not
perfectly matched to the document (notably, it can't encode the
flexibilities, so it comes out as rigid).

Tools like this can be incredibly useful. But they are TOOLS, and the
code belongs to you. They are not your masters.

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:46 +1000

csiph-web