On passing arguments to super class, an error flags: "module.__init__() takes at most 2 arguments (3 given)"? [duplicate]
class info:
def __init__(self, **kwargs):
self._variables = kwargs
class waybill(info):
def __init__(self, **kwargs):
super(waybill, self).__init__(**kwargs)
Error -: module.__init__() takes at most 2 arguments (3 given)
What could probably the reason why this error is flagging? I am usin开发者_如何学Gog Python 3.2
Is info defined in the same file? Or is it info.info from info.py? If you're importing info, trying changing it to the following:
from info import info
Additional information: If you simply import info
then info
is a module, and waybill
is subclassing module
.
super(waybill, self).__init__(kwargs)
should be:
super(waybill, self).__init__(**kwargs)
精彩评论