python - inheritance, necessity of __init__ -


the link below nice, gives example if inheritance without having not-so-nice looking foo.__init_(...) foo soon-to-be subclass of class bang: class foo(bang):...

https://docs.python.org/3.3/tutorial/classes.html#private-variables

question: if want create new variables inside class, self._biz? must create __init__ method?

yes, if want create instance variables, should override __init__ (and sure call parent class's implementation, too).


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -