Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does pylint want 2 public methods per class?

Tags:

python

pylint

I understand from this answer why the warning exists. However, why would the default value of it be 2?

It seems to me that classes with a single public method aside from __init__ are perfectly normal! Is there any caveat to just setting

min-public-methods=1

in the pylintrc file?

like image 540
bluehallu Avatar asked Feb 10 '23 20:02

bluehallu


1 Answers

The number 2 is completely arbitrary. If min-public-methods=1 is a more fitting policy for your project and better matches your code esthetic opinions, then by all means go for it. As was once said, "Pylint doesn't know what's best".

like image 100
user7610 Avatar answered Feb 13 '23 10:02

user7610