类的创建时是用type 实现的
def __init__(self, name): self.name = name def fun(self): print("%s is talking'%self.name) func = type('foo', (object, ), { 'talk':fun, '__init__', __init__) f = func('alex') f.talk()