类对象与类实例的创建过程(type, metaclass, __new__, __init__, __call__)

类对象与类实例的创建过程

类对象(type object)的创建

使用class定义类对象

class Foo:
    pass


foo = Foo()
print(Foo, type(Foo))
print(foo, type(foo))

使用type()创建类对象

猜你喜欢

转载自www.cnblogs.com/zk416605134/p/12655134.html