class A: def __init__(self): print('A.init') self.a1 = 'a1' def __get__(self,instance,owner): print('A.__get__',self,instance,owner) return self class B: x = A() def __init__(self): print('B.init') # self.x = 100 self.x = A() print(B.x) print() b = B() print(b.x.a1) print()
初级程序员
by: 江湖夜雨 发表于:2021-02-05 17:15:20 顶(1) | 踩(2) 回复
感觉很不错
回复评论