googleapis / googleapis/google-cloud-python

Model doesn't call `super.__init_`

Aperta
#15,833 3 commenti 0 reazioni 1 assegnatario Rivendicata da @daniel-sanche Vedi su GitHub
api: datastore api: ndb priority: p3 type: bug
Lingua principale
Python
Stelle
5.4k
Fork
1.8k
Merge medio
3g 4h
PR unite (30g)
122

Descrizione

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!

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.