googleapis / googleapis/google-cloud-python

Model doesn't call `super.__init_`

オープン
#15,833 コメント 3 件 リアクション 0 件 担当者 1 名 @daniel-sanche が担当を希望しています GitHub で見る
api: datastore api: ndb priority: p3 type: bug
主要言語
Python
スター
5.4k
フォーク
1.8k
平均マージ
3日 4時間
マージ済み PR(30日)
122

説明

Hi all! Is there a reason that `Model.__init__` doesn't call `super().__init__`? I get that it takes all of the kwargs, but not calling `super().__init__` at all breaks multiple inheritance. Eg instantiating this class will never call `Other.__init__`:

```py
class Foo(ndb.Model, Other):
pass
```

If I add `super().__init__()` at the top of `Model.__init__`, that fixes this, and `Other.__init__` gets called correctly.

I can work around this by always putting other classes before `ndb.Model` in the inheritance list, but that's brittle and error-prone, and not documented.

Thanks in advance!

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。