1
如何在特定的基類上調用方法?我知道我可以在下面的例子中使用super(C, self)
來獲得自動方法解析 - 但我希望能夠指定我正在調用哪個基類的方法?如何在Python中調用特定基類的方法?
class A(object):
def test(self):
print 'A'
class B(object):
def test(self):
print 'B'
class C(A,B):
def test(self):
print 'C'
我假設你想知道如何爲'C'類做這個?你想在運行時區分一個實例嗎?你能展示你想如何使用這個功能嗎? – SethMMorton
@SethMMorton:其他人沒有任何基類可以調用 – Casebash
是的,我意識到這一點。我正在提示你想要什麼的更多細節。 – SethMMorton