DEV Community

loading...

Random python fact of the day

mike239x profile image Mike Lezhnin ・1 min read

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)

pic
Editor guide