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


Groups > comp.lang.python > #108297 > unrolled thread

Re: Pylint prefers list comprehension over filter...

Started byChris Angelico <rosuav@gmail.com>
First post2016-05-08 07:22 +1000
Last post2016-05-08 07:22 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#108297 — Re: Pylint prefers list comprehension over filter...

FromChris Angelico <rosuav@gmail.com>
Date2016-05-08 07:22 +1000
SubjectRe: Pylint prefers list comprehension over filter...
Message-ID<mailman.474.1462656153.32212.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web