[Tutor] pylint(too-many-nested-blocks)

Alex Kleider alexkleider at gmail.com
Tue Nov 30 20:49:34 EST 2021


This might be of interest (re  cyclomatic complexity) to you.

https://audiolion.github.io/python/2016/10/17/reducing-cyclomatic-complexity.html

On Tue, Nov 30, 2021 at 1:59 PM Phil <phillor9 at gmail.com> wrote:

> Thank you dn for taking the time to write a lengthy informative reply
> and thank you once again Cameron and Mats. I will endeavor to make good
> use of the advice given.
> > Does Python itself see this as an error and stop working, or is it only
> > the code-checker s/w?
>
> It's not so much an error message, rather a recommendation and one that
> I feel that I should act on.
>
> > Were we conducting a Code Review, this function would definitely attract
> > criticism. You have already recognised the complexity, but seem somewhat
> > satisfied - on the  grounds that the whole works.
>
> I think I've only ever produced one application that was truly useful.
> My current project doesn't do anything that others cannot, it's just a
> my-way project and so I could leave it as it is or try to make it look
> more a work of art.
>
>
> > Here's where things become rather subjective. You (no criticism) seem to
> > have a mathematical view of programming,
>
> Isn't computer programming a pursuit based on maths? Even so, I suppose
> the result doesn't need to look like a dog's breakfast.
>
>
> > I have been criticised (but exhibit little remorse) for breaking things
> > down into "smaller" units of code than others feel necessary.
>
> I can see where I could split the function that I posted into two and
> one of those parts could be reused in a yet-to-be-written function. I do
> try to reuse code where I can. I'll need to give a lot more thought to
> how I might reduce the complexity.
>
>
> > Now is a good time pick-up the testing tool's feedback: "understandable
> > and maintainable". It's not merely a matter of
> > "readability"/"understandability", but also maintainability - and that
> > of the objectives of the tool: "testability".
>
> I know that testing tools exist, however, I've always considered their
> use to be beyond the understanding of the neophyte especially this
> amateur programmer.
>
>
> > Earlier the idea of naming a chunk of code was mentioned.
>
> I find it difficult to come up with meaningful names for functions and
> even variables. I know that 'x' or 'y' is often a poor choice and I
> often leave them in place until I can think of something better. Often I
> don't and so they stay, and of course, I forget what they mean the next
> time I look at the code again.
>
>
> > (I'll leave you to research the topics-mentioned that may interest you,
> > as you see fit...)
>
> I haven't spent anytime on the laptop or the Internet for the fast few
> days and so I haven't had a chance to study the topic of cylomatic
> complexity, however, I do have a Wikipedia page open and I will try to
> gain some understanding of it after I post this e-mail.
>
> --
>
> Regards,
> Phil
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list