[Python-projects] Pylint W0231 appears when base __init__ only called from another method

Andrew Tonner rakslice at gmail.com
Mon Mar 26 22:59:02 CEST 2007


I have a class that's defined with a parent class, where the __init__
method of the child class does not call the parent's __init__ method
directly, but still calls it via another method in the class, for
instance:

...

class Foo(Bar):
    def __init__(self):
        self.otherMethod()
    def otherMethod(self):
        Bar.__init__(self)

When I do this, I still get pylint warning W0231 on Foo.__init__
("__init__ method from base class 'Bar' is not called")

Is that appropriate for the warning?  It does not quite fit with the
description for that warning offered on the pylint features page
("Used when an ancestor class method has an __init__ method which is
not called by a derived class.")

Pylint version: 0.13.1
Python version: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC
v.1310 32 bit (Intel)] on win32

-AT


More information about the Python-Projects mailing list