Can subclasses in Python inherit parent class decorator
<p>If I apply a decorator to a class:</p>

<pre><code>from flask.ext.restful import Resource

@my_decorator()
class Foo(Resource): ...
</code></pre>

<p>Will it be automatically applied to any subclass methods as well? For example, will it be <em>magically</em> applied to <code>a_foobar_method</code>?</p>

<pre><code>class FooBar(Foo):

    def a_foobar_method(self):
        ...
</code></pre>

<p>Decorators do not "mark" the decorated class in any way. There is no way to tell if you wrote</p>

<pre><code>@decorator
class Foo:
    pass
</code></pre>

<p>or</p>

<pre><code>class Foo:
    pass

Foo = decorator(Foo)
</code></pre>

<p>simply by looking at <code>Foo</code> itself. Decorators are just applied at the point of use, and then are forgotten.</p>

python python-decorators