This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients Yoshanuikabundi, docs@python, gvanrossum, rhettinger
Date 2022-02-21.21:37:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
To me, this looks like a way too extensive edit jsut to emphasize a corner case that rarely arises in practice.   It bends over backwards to force an awkward definition regarding what an ABC really is.

A more minimal edit is to just note that inspect.isabstract() returns true if a class inherits from ABC and has at least one remaining abstractmethod.  

That tells the truth without having to redefine an ABC.  And it matches the spirit of the ABC mechanism.  At no point does ABCMeta ever require that any class in the chain must have ever defined an abstractmethod.  Instead, its only rule is that if there is least one remaining abstractmethod, it will refuse to instantiate.  Roughly:

  if any(getattr(meth, '__isabstractmethod__', False) for meth in meths):
     raise TypeError("Can't instantiate")

Note, any() defaults to False if there are no inputs and that the actual C code works the same way.  Even if a class never defines any abstractmethods, this test still occurs.  For an empty ABC, it just happens to always succeed in instantiating because there is no work left to be done.

Worldviews aside, I don't think it helpful to users to everywhere rewrite what it means to be an ABC just to make it match the output of inspect.isabstract() which is just short for inspect.has_abstract_methods_remaining().

Guido, any thoughts?
Date User Action Args
2022-02-21 21:37:43rhettingersetrecipients: + rhettinger, gvanrossum, docs@python, Yoshanuikabundi
2022-02-21 21:37:43rhettingersetmessageid: <>
2022-02-21 21:37:43rhettingerlinkissue46814 messages
2022-02-21 21:37:43rhettingercreate