Someone
public python v1 · immutableclass Protected(type): def __init__(cls, name, bases, dct): print 'in metaclass init' classInit = dct['__init__'] print 'found key init:', classInit def newInit( self, *args, **kwargs ): print 'in new init' classInit( self, *args, **kwargs ) dct['__init__'] = newInit super(Protected, cls).__init__(name, bases, dct)class Foo: __metaclass__ = Protected def __init__(self): print 'in Foo.init' self.val = 123f = Foo()f.value = 999