Skip to content

Model doesn't call super.__init_ #1025

@snarfed

Description

@snarfed

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__:

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: datastoreIssues related to the googleapis/python-ndb API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions