class object's attribute is also the instance's attribute?

陈伟 chenwei.address at gmail.com
Thu Aug 30 06:55:25 EDT 2012


when i write code like this:

class A(object):
     
    d = 'it is a doc.'
    

t = A()

print t.__class__.d
print t.d

the output is same.

so it means class object's attribute is also the instance's attribute. is it right? i can not understand it.



More information about the Python-list mailing list