Nick Coghlan added the comment: This is going to be the case anytime an attempt is made to combine parent classes with incompatible constructor signatures. "type" is unusual in that it goes to great lengths to present an adaptive signature that aligns with whatever the class definition does.
The main relevant trick is to filter the extra arguments out from those passed to metaclasses such that only init_subclass sees them: ================ def ignore_extra_args(base): base_meta = type(base) class _FilteredMeta(base_meta): def __new__(*args, **kwds): return base_meta.__new__(*args) def __init__(*args, **kwds): return base_meta.__init__(*args) class _Filtered(base, metaclass=_FilteredMeta): pass return _Filtered class InitX(): def __init_subclass__(cls, x=None): print('x') from abc import ABCMeta class Abstract(metaclass=ABCMeta): pass class AbstractWithInit(ignore_extra_args(Abstract), InitX, x=1): pass AbstractWithInit() ================ If folks were to iterate on "ignore_extra_args" variants outside the standard library with 3.6, then it would be something we could sensibly standardise for 3.7. ---------- nosy: +ncoghlan _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29581> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com