Rebinding __setattr__

alex23 wuwei23 at
Tue Sep 16 03:44:29 CEST 2008

On Sep 16, 7:12 am, "Jan Schilleman" <jan.schille... at> wrote:
> That still would require changing the source of the library ... And i'm not
> sure if it would have side effects.

I'm not on a Windows box so can't test this atm, but perhaps you could
make a proxy object?

class DispatchBaseProxy(object):
    def __init__(self):
        self.base = DispatchBaseClass()
    def __setattr__(self, attr, value):
        "insert extra functionality here"
        setattr(self.base, attr, value)
    def __getattr__(self, attr):
        getattr(self.base, attr)

More information about the Python-list mailing list