Nagy László Zsolt <gand...@shopzeus.com> writes: > > [...] > >> class BootstrapDesktop(BootstrapWidget, BaseDesktop): > >> def __init__(self, appserver, session): > >> # there is NOTHING else here, it just connects bootstrap widget > >> implementation with desktop methods > >> super(BootstrapDesktop, self).__init__(appserver, session) > > The correct way to do that is to simply not define an __init__ method at > > all. > But I have to initialize some default attributes.
Then the statement “there is NOTHING else here” must be false. Either the custom ‘__init__’ does something useful, or it doesn't. > > See this explanation of C3 linearisation here: > > > > https://www.python.org/download/releases/2.3/mro/ > I do not use diamond shapes in my hierarchy, I guess that does not > affect me. I may be wrong. With classes all inheriting ultimately from ‘object’ (as all Python 3 classes do, and as all current Python 2 classes should), mutliple inheritance inevitably places your classes in a diamond inheritance pattern. And, what's more, you can't know when writing a class whether it participates in a multiple inheritance hierarchy! So in practice you must write every class so that it will behave well in a diamond inheritance pattern. All this is covered in Raymond Hettinger's material, so it's best that I just leave you to read that. -- \ “If the arguments in favor of atheism upset you, explain why | `\ they’re wrong. If you can’t do that, that’s your problem.” | _o__) —Amanda Marcotte, 2015-02-13 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list