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
  • 143,180
  • 12
  • 188
  • 271
zkurtz
  • 3,230
  • 7
  • 28
  • 64

0 Answers0