] > Re: [Python-projects] Not enough public methods (Logilab.org)

Email Re: [Python-projects] Not enough public methods

from
Mateusz Łoskot <mateusz at loskot dot net>
subject
Re: [Python-projects] Not enough public methods
date
2006/01/15 05:34
Nicolas Chauvat wrote:
> Thanks for using pylint !

> On Sat, Jan 14, 2006 at 06:19:59PM +0100, Mateusz ?oskot wrote:

>>I'd like to have TestClass as a simple structure (struct from C) so I
>>don't need any methods.
>>Unfortunately, I can't understand it's explanation I found in the manual:
>>
>>R0903: Used when class has not enough public methods. This message belongs
>>to the design checker.


> From an abstract design point-of-view, an empty class is not good. If
> you have a perfectly valid reason for the class above, just tell
> pylint to shut up.

I see, so that's also why the message says it comes from design checker.
I come from C++ and there isn't a problem with such structures.
Second, in C++ from design and safety point of view there is no 
difference between those two classes (structs):

class A
{
    int a;
public:
    int getA() { return a; }
    void setA(int v) { a = v; }
};

class A
{
public:
    int a;
};

So, if so simple accessors and mutators are defined
for all private data members there is no difference between those 
classes above.

That's the reason the message from PyLint confused me a bit :-)


>>What is wrong? What should I add to my class to make PyLint happy? :-)


> Just disable the R0903 message if it annoys you or just ignore it in
> this case.

Yup.

Thank you
-- 
Mateusz Åoskot
http://mateusz.loskot.net
_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects


is a reply to