クラスを継承し、基本クラスから継承されたメソッドを上書きしました。しかし、問題は、最初に宣言されたメソッドを呼び出すことによってバイパスしたい例外を中間メソッドが作成することです。2 番目の呼び出しを無視するようにmroに指定する方法はありますか?
例は次のとおりです。
class Base(object):
def __init__(self):
res = "Want this"
print res
class BaseA(Base):
def __init__(self):
res = super(BaseA, self).__init__()
res = "Not this"
print res
class BaseB(BaseA):
def __init__(self):
res = super(BaseB, self).__init()
#At this poing res is "Not this"
#The desire is that it would be "Want this"
print res
どうもありがとう
PD: クラス BaseB(Base, BaseA) のようなものが機能しますか?