Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Stephen Hansen Newsgroups: comp.lang.python Subject: Re: Pylint prefers list comprehension over filter... Date: Sat, 07 May 2016 14:35:50 -0700 Lines: 26 Message-ID: References: <572BF2BF.6000000@icloud.com> <1462498631.232041.599637409.25D91C08@webmail.messagingengine.com> <572E3F53.5010703@icloud.com> <1462656950.727725.601099753.30D90B95@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de oMIZ65+9/jEekQksIE+7vgIV4rzaj4W8v1iE6Xtkfq+Q== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'reject': 0.05; 'subject:skip:c 10': 0.07; 'received:internal': 0.09; 'thu,': 0.15; 'happy.': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'pep8': 0.16; 'pythonic': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'say,': 0.18; "shouldn't": 0.18; 'first,': 0.20; '(the': 0.22; 'stephen': 0.22; 'sat,': 0.23; 'header:In-Reply- To:1': 0.24; 'subject:list': 0.26; 'correct': 0.28; 'fine': 0.28; 'document,': 0.29; 'mind,': 0.29; "i'm": 0.30; 'code': 0.30; '(i.e.,': 0.30; "i'd": 0.31; 'especially': 0.32; 'options': 0.33; 'purposes,': 0.33; 'list': 0.34; 'filter': 0.35; 'but': 0.36; 'possible.': 0.36; 'tool': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'hiring': 0.37; 'received:66': 0.38; 'wrong': 0.38; 'mean': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; 'header:Message-Id:1': 0.61; 'default': 0.61; 'engine': 0.62; 'hand': 0.82; '"yes,': 0.84; 'subject:over': 0.84 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=ixokai.io; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=KOAdeY1waiXkr51luX6SkqSSHf8=; b=gqiJVE pEDEmJGlzWvaZW9FWKJ70myfeHu0f+mWCGTbRruyQHtUa35GO+OvGHUbs+s1GZz8 OqKJ3yVc9gCS7IeXn1OkLesTlW2Gqr7XliGok4vCS0xoL7s+a33o2xhP6Cn1Pldk Tk63VY4RbBcrBvbovw9F3ncssyOsgJhxpyyyk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=KOAdeY1waiXkr51 luX6SkqSSHf8=; b=iCeb0E5BPr/GB6vzQZ2YXQ98VqfGgqP62eKaHEElGKHuRgl Q9PYd8d3qcc5x+pDIuNSKxhqzbwL02NvP0mUYLcmyAjk29E4TTcrvK2SR3TdSlZY 74eKBKUwvl+/nFUxnSo8mWn6STcr4G9RuZqcybmPOVj1Ai6F5mgXmFeT3lqc= X-Sasl-Enc: fpXmyaMui6dXNH4DpQzKTxhBYGSDzEHcfd/GrMA7nPB+ 1462656950 X-Mailer: MessagingEngine.com Webmail Interface - ajax-140377c4 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <1462656950.727725.601099753.30D90B95@webmail.messagingengine.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:108299 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*. Its fine to use, but I'd read over PEP8 (the document, not the tool) and apply style guide recommendations thoughtfully, not mechanically. -- Stephen Hansen m e @ i x o k a i . i o