Maximum Number of Class Attributes

Sylvain Thenault sylvain.thenault at nospam.logilab.fr
Wed Jan 26 04:03:47 EST 2005


On Wed, 26 Jan 2005 02:03:12 +0000, Bob Parnes wrote:

> In its default configuration, my version of pylint (0.5.0) sets the
> maximum number of class attributes at 7. This seems low to me, but I can
> see how an excessive number might make maintenance more difficult. Is this
> indeed the best value for a maximum under ordinary conditions? If not, can
> anyone suggest a more  reasonable value?

well, this value is very subjective, and may change from one context to
another... For instance at some point I hope that pylint will detect "GUI"
classes and allow more attributes (and methods?) to those. 
Anyway that's just an indicator, not a rule of thumb (and pylint itself
has some class with more than 7 attributes...). 

And FYI, this value has been taken from a post to the
testdrivendevelopment at yahoogroups (as most others default values in the
"design analysis" checker). Hum, well... After checking it seems that the
post said 20 attributes. I don't remember why did i get this number down
to 7. If this discussion leads to an agreement for a better number, I
can change the default value.

-- 
Sylvain Thénault                               LOGILAB, Paris (France).

http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org





More information about the Python-list mailing list