On 2018-08-14 03:38 AM, Frank Millman wrote: > Hi all > > Pylint is flagging a lot of lines as errors that I would consider to be > acceptable. > > I have an abstract class ClassA with a number of concrete sub-classes. > ClassA has a method which invokes 'self.method_b()' which is defined > separately on each sub-class. Pylint complains that "Instance of > 'ClassA' has no 'method_b' member". > > First question - as a matter of style, is Pylint correct? If so, I could > define 'method_b' in ClassA and raise NotImplementedError. Is this > considered more pythonic? The downside is that I have quite a few of > them, so it would add some clutter.
I would add the method. It's one line: def method_b(self): raise NotImplementedError When you say that you have quite a lot of them, what is "them"? Many master classes or many methods in the class? If the latter, one line each isn't so bad. If the former I wonder if a master, master class is called for. I am also getting a funny smell from your description. Are you sure that you need to redefine the methods? Perhaps you just need to define some class variables and use one method. You can also define your own method and call the classA method inside it for common functionality. Just my 2¢ based on no information about your actual application. -- D'Arcy J.M. Cain Vybe Networks Inc. http://www.VybeNetworks.com/ IM:da...@vex.net VoIP: sip:da...@vybenetworks.com -- https://mail.python.org/mailman/listinfo/python-list