class Foo: def __init__(self, x): self.x = x print(Foo) def __init__(self,x): self.x = x FFo = type(‘FFo‘,(object,), {‘__init__‘: __init__}) print(FFo) print(FFo.__dict__) f = FFo(1) print(f.x)
类的定义
原文:https://www.cnblogs.com/majianyu/p/10269426.html