开发者

On passing arguments to super class, an error flags: "module.__init__() takes at most 2 arguments (3 given)"? [duplicate]

开发者 https://www.devze.com 2023-03-20 13:24 出处:网络
This question already has answers here: TypeError: module.__init__() takes at most 2 arguments (3 given)
This question already has answers here: TypeError: module.__init__() takes at most 2 arguments (3 given) (6 answers) Closed 7 years ago.
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)
0

精彩评论

暂无评论...
验证码 换一张
取 消