diff --git a/pep-0422.txt b/pep-0422.txt --- a/pep-0422.txt +++ b/pep-0422.txt @@ -133,6 +133,11 @@ ``super()`` works as expected, since the ``__class__`` reference is already initialised. +To support cooperative multiple inheritance of the class initialisation hook, +``object`` will have an ``__init_class__`` method (which will do nothing). As +a consequence, it will be safe to call ``super().__init_class__()`` without +checking if it exists. + This general proposal is not a new idea (it was first suggested for inclusion in the language definition `more than 10 years ago`_, and a similar mechanism has long been supported by `Zope's ExtensionClass`_), @@ -290,12 +295,7 @@ @classmethod def __init_class__(cls): # Process any classes later in the MRO - try: - mro_chain = super().__init_class__ - except AttributeError: - pass - else: - mro_chain() + super().__init_class__() # Process any __decorators__ attributes in the MRO for entry in reversed(cls.mro()): decorators = entry.__dict__.get("__decorators__", ())