DEV Community

Mike Lezhnin
Mike Lezhnin

Posted on

3 2

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.

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay