KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm a little confused about how arguments are passed between Subclasses and Superclasses in Python. Consider the following class structure: class Superclass(object): def __init__(self, arg1, arg2, arg3): #Inilitize some variables #Call some methods class Subclass(Superclass): def __init__(self): super(Subclass, self).__init__() #Call a subclass only method Where I'm having trouble is understanding how arguments are passed between the Superclass and Subclass. Is it necessary to re-list all the Superclass arguments in the Subclass initializer? Where would new, Subclass only, arguments be specified? When I try to use the code above to instantiate a Subclass, it only expects 1 argument, not the original 4 (including self) I listed. TypeError: __init__() takes exactly 1 argument (4 given)
Tags (comma-separated)
Save Edits
Cancel