from
Fabien Schwob <skink at evhr dot net>
to
Mateusz Łoskot <mateusz at loskot dot net>
cc
Python-Projects <python-projects at lists dot logilab dot org>
subject
Re: [Python-projects] Not enough public methods
date
Mateusz Åoskot a écrit :2006/01/15 13:54
> Hi,
>
> I'd like to ask you for explanation of following [R] message:
> "Not enough public methods (0/2)"
>
> PyLint reports it for this class:
>
> class TestClass:
> """This is class documentation."""
>
> def __init__(self):
> """Default constructor."""
> self.id = 0
> self.name = ""
> self.params = []
>
> 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.
>
> What is wrong? What should I add to my class to make PyLint happy? :-)
>
In my mind, but I can make mistake, it's simpler to use a dictionary.
d1 = {"id" : 0, "name" : "", "params" : []}
It make sense to use a class when you will have method that will make it
manipulation easier. But in this case, I think it will be faster to use
a dictionary.
--
DerriÚre chaque bogue, il y a un développeur, un homme qui s'est trompé.
(Bon, OK, parfois ils s'y mettent à plusieurs).
_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects
