googleapis / googleapis/google-cloud-python

Model doesn't call `super.__init_`

Đang mở
#15,833 3 bình luận 0 reaction 1 người được giao Được @daniel-sanche nhận Xem trên GitHub
api: datastore api: ndb priority: p3 type: bug
Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
122

Mô tả

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!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.