可能性の重複による混乱:
Understanding Python super()[パイソン]:スーパー()
クラスB
サブクラスクラスA
、Bの__init__
におけるので、我々はこのようなAの__init__
を呼び出す必要があります。
class B(A):
def __init__(self):
A.__init__(self)
しかし、super()
、私はこのような何かを見た:
class B(A):
def __init__(self):
super(B, self).__init__() #or super().__init__()
を私の質問は以下のとおりです。
なぜ
super(B, self).__init__(self)
?戻りプロキシオブジェクトはバインドされたオブジェクトなので、スーパーで2番目の引数を省略し、返されたプロキシオブジェクトがバインドされていない場合は、
super(B).__init__(self)
と書いてください。
super()
他にも多数ありますので、まず検索してください。 [どうすればいいのですか?](http://stackoverflow.com/questions/607186/how-does-pythons-super-do-the-right-thing)[how-does-pythons-super-do-the-right-thing] -python-super-work-with-multiple-inheritance](http://stackoverflow.com/questions/3277367/how-does-pythons-super-work-with-multiple-inheritance)[usage-of-python-3 - スーパー](http://stackoverflow.com/questions/2771904/usage-of-python-3-スーパー) – agf