Reputation: 17392
class X():
@decorator
def method(self):
return
class Y(X):
def method(self):
return
Is there any way where the applied decorators still applies on child class method
without explicitly decorating them?
Upvotes: 1
Views: 606
Reputation: 25980
Nope, since overriding methods creates a completely new object. It is the same logic that super(...).__init__
does not get called automatically, and the general Python guideline of be explicit - for example, if that happened by default, but you did not want the decorator, how would it work?
Does not seem like too much work to be explicit here, and decorate.
Upvotes: 1