Given the following:
ParentModule.py
class ParentClass():
def __init__(self):
pass
ChildModule.py
class ChildClass(ParentClass):
def __init__(self):
pass
If, in ChildModule, I mistakenly import the parent module and not the parent class, i.e.:
import ParentModule
instead of the correct
from ParentModule import ParentClass
I will get the following error:
TypeError: module.__init__() takes at most 2 arguments (3 given)
So just what are these 3 implicit arguments passed to ParentModule's __init__()? What are the 2 arguments ParentModule.__init__() is expecting?
How does one take advantage of this functionality?
NameError: name 'ParentClass' is not defined.ParentClassandParentModulemost likely had the same name in the real code, or the real code hadclass ChildClass(ParentModule)instead ofclass ChildClass(ParentClass).