6

The implementation of abstractclassmethod abc.py in Python 3.4 looks like this:

class abstractclassmethod(classmethod):

    __isabstractmethod__ = True

    def __init__(self, callable):
        callable.__isabstractmethod__ = True
        super().__init__(callable)

The answer for Python 2.7 Combine abc.abstractmethod and classmethod is based on this implementation.

Why is it necessary to set __isabstractmethod__ on the callable? Wouldn't it be enough to set the class variable __isabstractmethod__ of class abstractclassmethod? Which use case would not work, if the whole __init__() definition would be removed (like in abstractproperty)?

Community
  • 1
  • 1
someone
  • 91
  • 2

0 Answers0