摘要:
1.反射 1)神赐给你的内置函数 : a: getattr(命名空间,'函数名') == 命名空间.属性名; 这里的命名空间指的是对象或者类; b: getattr四个应用场景: 1)类名.名字 <==> getattr(类名,'名字') 2)对象名.名字 <==> getattr(对象名,'名字' 阅读全文
posted @ 2018-07-31 21:57
pythonZhou
阅读(216)
评论(0)
推荐(0)
摘要:
1.isinstance() 1)class A:pass class B:pass b = B() print(isinstance(b,B) #True #isinstance(obj,type) print(isinstance(b,A) #True 2)class A:pass class 阅读全文
posted @ 2018-07-31 20:45
pythonZhou
阅读(201)
评论(0)
推荐(0)

浙公网安备 33010602011771号