Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pylint error W0232: class has no __init__ method

I have the following error with pylint:

Pylint error W0232: class has no __init__ method

I understand what it means. I have to create the __init__ method. The problem is that this class is inherited from parent class. I know that I'm able to create the __init__ method and just use super(myclass, self).__init__() but is it really necessary? I have nothing to add to __init__. I want to know if it is a better practice to create __init__ method in any class.

like image 687
Weiner Nir Avatar asked Oct 27 '13 19:10

Weiner Nir


1 Answers

As @Sean pointed out, pylint should not complain if __init__() is defined in a parent class. Сhances are pylint cannot find that class. Make sure the module defining it is actually loaded when you invoke pylint (e.g. run it on the containing package).

like image 130
Eugene Yarmash Avatar answered Oct 16 '22 11:10

Eugene Yarmash