Say, we have a (parent) class P.
It has N child classes C1(P), C2(P) ... CN(P)

Each of the child classes defines (differently) a method func().

I wish to decorate all of the CX.func() in the same way.  One way to
do this is to add a decorator to each of the derived classes.  But
this is tedious and involves modifying multiple files.

Is there a way to modify the parent class and have the same effect?
Or some other way neater than the above?

Thanks.



visual:
class P(object):
   ...

class C1(P):
    def func(self, ...):
        ...

class C2(P):
    def func(self, ...):
        ...
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to