【发布时间】:2010-11-13 12:36:07
【问题描述】:
假设我设置了以下类:
class Foo:
def __init__(self, frob, frotz):
self.frobnicate = frob
self.frotz = frotz
class Bar:
def __init__(self, frob, frizzle):
self.frobnicate = frob
self.frotz = 34
self.frazzle = frizzle
我如何(如果可以的话)在这种情况下使用 super() 来消除重复代码?
【问题讨论】:
标签: python inheritance constructor super