googleapis / googleapis/google-cloud-python

Model doesn't call `super.__init_`

未关闭
#15,833 3 条评论 0 个 reaction 已指派 1 人 已被 @daniel-sanche 认领 在 GitHub 查看
api: datastore api: ndb priority: p3 type: bug
主要语言
Python
星标
5.4k
派生
1.8k
平均合并
3 天 4 小时
30 天内合并 PR
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 摘要。