class myDecorator(object):

    def __init__(self, inner):
        self.inner = inner
self.log = {}

def __getattr__(self, name):
    self.log[name] = self.log.get(name, 0) + 1
return getattr(self.inner, name)

def __setattr__(self, name, value):
    setattr(self.inner, name, value)
Суммарный счетчик для ведения журнала Python