oop - if a class does not define __init__ will Python call parent classes until it resolves? -


python resolve method name in class of method , parent classes of class until resolves.

does apply constructor well. i.e., if class not define __init__() parent does, parent constructor automatically called?

the short answer is: yes. how inheritance works.

this reason why should call parent constructor explicitly of time (unless want otherwise reason), when overriding method within child class.

it worth learning method resolution order in python: method resolution order (mro) in new style python classes. defines order methods resolved (especially important in case of multiple inheritance).


Comments