I need to create a subclass from a parent class that has lots of methods, and need to decorate all of these. Is there pythonic way of doing this other than:
def myDecorator (meth): @wraps(meth) def newMeth (*args, **kw): print("Changing some arguments here.") return meth(newargs, **kw) return newMeth class Parent: def method1(self,args): pass def method2(self,args): # and so on... def methodn(self,args): pass class Mine(Parent): for thing in dir(Parent): if type(eval("Parent."+thing)) == type(Parent.method1): eval(thing) = myDecorator(eval("Parent." + thing)) I'm not even sure that this works! Thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list