Passing arguments to subclasses
news at prodata.co.uk
Mon Jun 23 17:38:43 CEST 2008
May I ask a simple newbie question, which I presume is true, but for
which I can't readily find confirmation:
Let's say I have a parent class with an __init__ method explicitly
def __init__(self, keyword1, keyword2):
and I subclass this:
# No __init__ method explicitly defined
Now I presume that I can instantiate a child object as:
child = ChildClass(arg1, arg2)
and arg1, arg2 will be passed through to the 'constructor' of the
antecedent ParentClass (there being no overrriding __init__ method
defined for ChildClass) and mapping to keyword1, keyword2 etc.
Have I understood this correctly?
More information about the Python-list