DEV Community

Mike Lezhnin
Mike Lezhnin

Posted on

Random python fact of the day

If you have an abstract base class with a static method, then the order of decorators should be like that:

@staticmethod
@abstractmethod
def my_fancy_method():
    pass

If you switch them around you would get AttributeError: attribute '__isabstractmethod__' of 'staticmethod' objects is not writable. Now you know.

Discussion (0)