【python】类(资料+疑惑)

发布时间:2017-1-18 15:59:10 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"【python】类(资料+疑惑) ",主要涉及到【python】类(资料+疑惑) 方面的内容,对于【python】类(资料+疑惑) 感兴趣的同学可以参考一下。

class C1(object):    a = 'abc'    def __getattribute__(self, *args, **kwargs):        print("__getattribute__() is called")        return object.__getattribute__(self, *args, **kwargs)    def __getattr__(self, name):        print("__getattr__ is called")        return name + "from getattr"    def __get__(self, instance, owner):        print("__get__() is called", instance, owner)        return self    def foo(self, x):        print(x)class C2(object):    d = C1()if __name__ == "__main__":    c = C1()    c2 = C2()    print "====="    print(c.a)    print "------"    print(c.zzzz)    print "------"    c2.d    print "------"    print(c2.d.a)

上一篇:Apache shiro之身份验证(登陆)流程
下一篇:Maven项目加载JAR包

相关文章

相关评论