Hi, As documented, the default constructor for objects that inherit from Base doesn't work in multiple inheritance situations (unless Base is last in the list of classes, I suppose). It wouldn't be too difficult to change this without breaking existing expectations, I believe. Something like this:
def _declarative_constructor(self, **kwargs): """A simple constructor that allows initialization from kwargs. Sets attributes on the constructed instance using the names and values in ``kwargs``. Differs from the default constructor in that (a) keys not present in the attributes of the instance's class are ignored; (b) we call super at the end to ensure proper multiple inheritance behaviour. """ cls_ = type(self) unused_kwargs = dict() for k in kwargs: if hasattr(cls_, k): setattr(self, k, kwargs[k]) else: unused_kwargs.update({k:kwargs[k]}) super(Base, self).__init__(**unused_kwargs) This plays well with other classes, and still raises a TypeError exception if there are kwargs specified which are not used in the MRO. Would a pull request implementing this be accepted? I did have a look around but didn't find previous discussion of this issue, but apologies if I missed something. Best wishes, Jonathan. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.