2

With python abstract classes, is there a way to require that a class instance does not override a particular method?

Using the @abstractmethod decorator on a method requires the child class to define the method. Skipping the @abstractmethod decorator allows the child to skip defining the method and "silently inherent" the abstract method. What I'd like is something like a @onlyabstractmethod to decorate a method that I want to ensure the child does not override.

ShadowRanger
  • 124,179
  • 11
  • 158
  • 228
zkurtz
  • 3,042
  • 6
  • 24
  • 59

0 Answers0