多重继承init的参数问题
class SkillMixin(): def __init__(self, skill): self.__skill = skill def get_skill(self): return self.__skill class BasketballMixin(SkillMixin): def __init__(self): super(BasketballMixin, self).__init__('basketball') #这里会报参数错误 why? class FootballMixin(SkillMixin): def __init__(self): super(FootballMixin, self).__init__('football') class BasketballAndFootball (BasketballMixin, FootballMixin): def __init__(self): super(BasketballAndFootball, self).__init__() s1 = BasketballMixin() s2 = BasketballAndFootball()
注释的地方会报错 提示只有1个参数但是给了两个
不符合原题目,但是不懂这里为啥会报错