I have a class containing a series of classes like this: class Th(Externaldevice): class _Communicate(commandset2.CommandSet_Communicate): def __getattribute__(self,attrname): attr = commandset2.CommandSet_Communicate.__getattribute__(self,attrname) if "__call__" in dir(attr): return functools.partial(Th._wrapper_function, self.parent, attr) else: return attr
class _System(commandset2.CommandSet_System): def __getattribute__(self,attrname): attr = commandset2.System_Communicate.__getattribute__(self,attrname) if "__call__" in dir(attr): return functools.partial(Th._wrapper_function, self.parent, attr) else: return attr That is, a a wrapper function is applied to a bunch of methods in a bunch of classes. The class declarations are simple, but even so, repetitive. Can anyone suggest a more compact representation for the class declarations? Also, because the parent class name is given explicitly in the class declarations, I can't over-ride the _wrapper_function in a child class, except by over-riding each of the class declarations. Is there a way to reference the _wrapper_function just to the containing class? Steve -- http://mail.python.org/mailman/listinfo/python-list