[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pylint false positives

On Sun, Aug 19, 2018 at 11:13 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> Obviously there is some (small) complexity cost to automating it. I
> didn't specify what a fair number of methods would be (my example showed
> four, but that was just an illustration, not real code). In practice I
> wouldn't even consider this for three methods. Six or eight seems like a
> reasonable cut-of point for me, but it depends on the specifics of the
> code and who I was writing it for.
> (Note that this makes me much more conservative than the usual advice
> given by system admins, when you need to do the same thing for the third
> time, write a script to automate it.)

The boundary definitely varies. I've often gone to a dozen
almost-identical blocks of code before turning them into a loop (when
the "almost" makes it a lot harder to collapse them usefully), and
sometimes, just two copies is enough to refactor. But six to eight
does seem like a reasonable point for tiny (maybe stub) functions.