#!/usr/local/bin/python2 class M(type): def __init__(self, name, bases, attrs): self.i = 1 self.d() def d(self): print self.i class C(object): __metaclass__ = M