On Fri, Jun 3, 2016 at 2:16 PM, Ben Finney <ben+pyt...@benfinney.id.au> wrote: > If you're writing a custom initialiser that handles two additional > parameters, then those parameters should not be present when you call > the super() method's initialiser:: > > # You specified Python 3, which allows simpler syntax. > > class LoremIpsum: > def __init__(self, spam, *args, **kwargs): > do_something_important_with(spam) > super().__init__(*args, **kwargs) > > class DolorSitAmet(LoremIpsum): > def __init__(self, spam, eggs=4, beans=None, *args, **kwargs): > self.eggs = eggs > self.beans = beans > super().__init__(spam, *args, **kwargs)
Except that since we're discussing design for multiple inheritance, the positional argument "spam" is inappropriate. All arguments should be passed by keyword; the DolorSitAmet.__init__ method cannot be certain that LoremIpsum will be the next class in the MRO, and the actual next class might not expect spam to be the first positional argument. -- https://mail.python.org/mailman/listinfo/python-list