[Tutor] Python 3 only: Better to use implicit or explicit "object" in class statements?

boB Stepp robertvstepp at gmail.com
Sun Jun 7 16:37:04 EDT 2020


On Sun, Jun 07, 2020 at 12:15:03PM -0600, Mats Wichmann wrote:

>Here's my claim:  listen to pylint, or someday you'll end up having to
>defend why you're doing something pylint complains about.  :)   Tools
>like Pylint and Black are pretty opinionated (although Black is so
>opinionated that you can't override most of its choices, while Pylint is
>almost infintely configurable), and sometimes it's just easier to go
>with the flow.

As you are obviously remembering, I have recently started "playing" with
Black and Pylint.  Black I don't even try to fight while I am using it as, I
probably cannot change its behavior -- the whole point of using it, really.
But Pylint, which has so many possibilities for customization, has
generated a real reluctance on my part to "tweak" it:

     1) I generally don't feel confident that I have enough knowledge and
        background to make the tweaks without either asking on this forum
        first and/or doing online research.
     2) In line with (1) it *has* caught misconceptions on my part even
        though (at the time) I was *certain* that it was a silly complaint.
        See, for instance, my post last night about an unneeded comprehension.
        I had forgotten which data file format I was currently dealing
        with and did not realize I could use dict() directly, something
        that, I am sure, never happens to you pros.  ~(:>))
     3) And it has been quite useful in finding things I had absolutely no
        clue about and needed to look up and learn.
     4) *If* I *do* reach the "full confidence" level to make a tweak then I
        have to give careful consideration as to whether I want to make the tweak
        applicable to all of my projects -- past, present and future -- or
        if I want to make it more narrowly applicable.  This creates a certain
        reluctance when it is usually quicker to just change the code.  A
        good example of this would be something like "with open(filename) as
        f".  There will surely follow a complaint about the single letter
        variable even though I don't think it will cause any future person
        misunderstanding.
     5) So your comment "...and sometimes it's just easier to go with the
        flow" seems to dominate for me.

All in all though I believe Pylint and company are proving (on balance)
helpful to my learning and preventing mistakes.

-- 
Wishing you only the best,

boB Stepp


More information about the Tutor mailing list