Thanks. Should’ve thought of that instead of redoing what MRO already does. It does solve the problem elegantly.
class Base:
def __init_subclass__(cls, **kwargs):
kwargs.pop('debug', None)
super().__init_subclass__(**kwargs)
class Foo(Base):
def __init_subclass__(cls, **kwargs):
if kwargs.get('debug'):
print(f'initialized from {Foo.__init_subclass__}')
super().__init_subclass__(**kwargs)
class Bar(Base):
def __init_subclass__(cls, **kwargs):
if kwargs.get('debug'):
print(f'initialized from {Bar.__init_subclass__}')
super().__init_subclass__(**kwargs)
class Baz(Foo, Bar, debug=True):
pass