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


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

Re: Pylint prefers list comprehension over filter...

Started byTerry Reedy <tjreedy@udel.edu>
First post2016-05-07 21:40 -0400
Last post2016-05-10 16:42 -0400
Articles 9 — 6 participants

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... 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

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

FromTerry Reedy <tjreedy@udel.edu>
Date2016-05-07 21:40 -0400
SubjectRe: Pylint prefers list comprehension over filter...
Message-ID<mailman.489.1462671648.32212.python-list@python.org>
On 5/7/2016 3:17 PM, Christopher Reimer wrote:

> For my purposes, I'm using the list comprehension over filter to keep
> pylint happy.

How sad.  The pylint developers arrogantly take it on themselves to 
revise Python, against the wishes of Guido and the other core 
developers, and you and feel obligated to follow them.

They should at least add a disclaimer "Using the default options, pylint 
checks that your code complies with the pylint-approved subset of Python."

-- 
Terry Jan Reedy

[toc] | [next] | [standalone]


#108465

FromClaudiu Popa <pcmanticore@gmail.com>
Date2016-05-10 06:51 -0700
Message-ID<e309810a-d9a7-42b9-8e9f-14b8c03ab482@googlegroups.com>
In reply to#108315
On Sunday, May 8, 2016 at 4:41:02 AM UTC+3, Terry Reedy wrote:
> On 5/7/2016 3:17 PM, Christopher Reimer wrote:
> 
> > For my purposes, I'm using the list comprehension over filter to keep
> > pylint happy.
> 
> How sad.  The pylint developers arrogantly take it on themselves to 
> revise Python, against the wishes of Guido and the other core 
> developers, and you and feel obligated to follow them.
> 
> They should at least add a disclaimer "Using the default options, pylint 
> checks that your code complies with the pylint-approved subset of Python."
> 
> -- 
> Terry Jan Reedy

Hi,

Thank you for letting us know. While pylint is indeed
opinionated in some cases, we're not trying to be
"arrogant", as you put it, towards Guido or the other core
developers. What's sad in this particular case is that the
feedback had to come in rather a harsh manner, on this group,
instead of being reported as a bug or an enhancement on pylint's
bug tracker.
Anyway, I wanted to tell you that I agree with your opinion
regarding that message and as such, it is removed and won't be
emitted anymore in the next release (1.6)

Thank you.

[toc] | [prev] | [next] | [standalone]


#108467

FromSteven D'Aprano <steve@pearwood.info>
Date2016-05-11 00:58 +1000
Message-ID<5731f70f$0$1590$c3e8da3$5496439d@news.astraweb.com>
In reply to#108465
Hi Claudiu,


On Tue, 10 May 2016 11:51 pm, Claudiu Popa wrote:

> Thank you for letting us know. While pylint is indeed
> opinionated in some cases, we're not trying to be
> "arrogant", as you put it, towards Guido or the other core
> developers. What's sad in this particular case is that the
> feedback had to come in rather a harsh manner, on this group,
> instead of being reported as a bug or an enhancement on pylint's
> bug tracker.
>
> Anyway, I wanted to tell you that I agree with your opinion
> regarding that message and as such, it is removed and won't be
> emitted anymore in the next release (1.6)

Thanks for being so understanding!

Speaking for myself, I think that the test for filter versus list
comprehensions is a reasonable test to include, so long as it is disabled
by default. Does PyLint support opt-in checks?



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#108469

Frompcmanticore@gmail.com
Date2016-05-10 08:35 -0700
Message-ID<f1ca2718-6178-4fa7-9b67-ca697ae9ed43@googlegroups.com>
In reply to#108467
On Tuesday, May 10, 2016 at 5:58:37 PM UTC+3, Steven D'Aprano wrote:
> Hi Claudiu,
> 
> 
> On Tue, 10 May 2016 11:51 pm, Claudiu Popa wrote:
> 
> > Thank you for letting us know. While pylint is indeed
> > opinionated in some cases, we're not trying to be
> > "arrogant", as you put it, towards Guido or the other core
> > developers. What's sad in this particular case is that the
> > feedback had to come in rather a harsh manner, on this group,
> > instead of being reported as a bug or an enhancement on pylint's
> > bug tracker.
> >
> > Anyway, I wanted to tell you that I agree with your opinion
> > regarding that message and as such, it is removed and won't be
> > emitted anymore in the next release (1.6)
> 
> Thanks for being so understanding!
> 
> Speaking for myself, I think that the test for filter versus list
> comprehensions is a reasonable test to include, so long as it is disabled
> by default. Does PyLint support opt-in checks?
> 
> 
> 
> -- 
> Steven


Hi Steven,

Yes, pylint is pretty configurable regarding its checks.
First of all, we have extensions, which are checks which were
found unsuitable to be part of the core, thus they need to be
manually activated, as in:

    $ pylint --load-plugins=pylint.extensions.name_of_the_extension

We also have a group of checks that are disabled by default, as
is the case of the Python 3 porting checker, recommended as well
by the Python 3 porting guide
(https://docs.python.org/3/howto/pyporting.html?highlight=pylint)
These needs to be enabled manually, as in:

    $ pylint --enable=python3
    $ pylint --enable=other_disabled_group

Last, but not least, each check can be (de)activated manually:

    $ pylint --disable=no-member
    # don't care about conventions and refactoring warnings
    $ pylint --disable=C,R
    $ pylint --disable=all --enable=no-member,other_check_I_want

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

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:

    $ pylint myproject
    # core checkers enabled
    10/10 - Congrats, you're clean on a core. You might try with "--pedantic" now.

    $ pylint myproject --pedantic
    # pedantic checkers enabled.
    10/10 - Congrats, you're clean on pedantic. You might try with --refactoring now

    $ pylint myproject --refactoring
    # refactoring checkers enabled
    10/10 - Congrats, you're clean on refactoring. Last up, try with --style now.

    $ pylint myproject --style
    10/10 - Now you're pylint clean.

    Or running them all:

    $ pylint myproject --all

(The discussion and whatnot can be found here
https://github.com/PyCQA/pylint/issues/746)

[toc] | [prev] | [next] | [standalone]


#108487

FromTerry Reedy <tjreedy@udel.edu>
Date2016-05-10 15:47 -0400
Message-ID<mailman.575.1462909641.32212.python-list@python.org>
In reply to#108469
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

[toc] | [prev] | [next] | [standalone]


#108488

FromChris Angelico <rosuav@gmail.com>
Date2016-05-11 06:22 +1000
Message-ID<mailman.576.1462911768.32212.python-list@python.org>
In reply to#108469
On Wed, May 11, 2016 at 1:35 AM,  <pcmanticore@gmail.com> wrote:
> 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:
>
>     $ pylint myproject
>     # core checkers enabled
>     10/10 - Congrats, you're clean on a core. You might try with "--pedantic" now.
>
>     $ pylint myproject --pedantic
>     # pedantic checkers enabled.
>     10/10 - Congrats, you're clean on pedantic. You might try with --refactoring now
>
>     $ pylint myproject --refactoring
>     # refactoring checkers enabled
>     10/10 - Congrats, you're clean on refactoring. Last up, try with --style now.
>
>     $ pylint myproject --style
>     10/10 - Now you're pylint clean.
>
>     Or running them all:
>
>     $ pylint myproject --all

Definitely support this notion. Not sure the "on a core" part makes
sense, but that's a minor triviality.

ChrisA

[toc] | [prev] | [next] | [standalone]


#108468

FromSteven D'Aprano <steve@pearwood.info>
Date2016-05-11 01:20 +1000
Message-ID<5731fc24$0$1599$c3e8da3$5496439d@news.astraweb.com>
In reply to#108465
A further comment:

On Tue, 10 May 2016 11:51 pm, Claudiu Popa wrote:

> Thank you for letting us know. While pylint is indeed
> opinionated in some cases, we're not trying to be
> "arrogant", 

And from the docs:

"What Pylint says is not to be taken as gospel and Pylint isn’t smarter than
you are: it may warn you about things that you have conscientiously done."

https://docs.pylint.org/intro.html#what-pylint-is-not

which has some nice advice for how to deal with pylint so the warnings are
not overwhelming.

I think it is time for me to check it out...


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#108486

FromTerry Reedy <tjreedy@udel.edu>
Date2016-05-10 15:34 -0400
Message-ID<mailman.574.1462908862.32212.python-list@python.org>
In reply to#108465
On 5/10/2016 9:51 AM, Claudiu Popa wrote:

> Thank you for letting us know. While pylint is indeed
> opinionated in some cases, we're not trying to be
> "arrogant", as you put it, towards Guido or the other core
> developers. What's sad in this particular case is that the
> feedback had to come in rather a harsh manner, on this group,
> instead of being reported as a bug or an enhancement on pylint's
> bug tracker.

My impression is that the objection to 'bad builtin' was communicated 
somehow to someone involved with PyLint  at least a year ago and ignored 
or outright rejected.  But I don't remember details.  I might be 
mistaken or have been given false information.

> Anyway, I wanted to tell you that I agree with your opinion
> regarding that message and as such, it is removed and won't be
> emitted anymore in the next release (1.6)

Then my harsh comment re pylint is not currently valid.  Thank you.

Hiring managers misusing the score to evaluate applicants is a different 
issue.

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#108489

FromDFS <nospam@dfs.com>
Date2016-05-10 16:42 -0400
Message-ID<ngtgso$h9e$1@dont-email.me>
In reply to#108486
On 5/10/2016 3:34 PM, Terry Reedy wrote:
> On 5/10/2016 9:51 AM, Claudiu Popa wrote:
>
>> Thank you for letting us know. While pylint is indeed
>> opinionated in some cases, we're not trying to be
>> "arrogant", as you put it, towards Guido or the other core
>> developers. What's sad in this particular case is that the
>> feedback had to come in rather a harsh manner, on this group,
>> instead of being reported as a bug or an enhancement on pylint's
>> bug tracker.
>
> My impression is that the objection to 'bad builtin' was communicated
> somehow to someone involved with PyLint  at least a year ago and ignored
> or outright rejected.  But I don't remember details.  I might be
> mistaken or have been given false information.
>
>> Anyway, I wanted to tell you that I agree with your opinion
>> regarding that message and as such, it is removed and won't be
>> emitted anymore in the next release (1.6)
>
> Then my harsh comment re pylint is not currently valid.  Thank you.
>
> Hiring managers misusing the score to evaluate applicants is a different
> issue.

Interesting.

Got any horror stories to share?



[toc] | [prev] | [standalone]


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


csiph-web