class A: def _ _init_ _(self): self.name = 'A' a = A()
Creates an instance attribute of an object a of type A, so it can be found in: a.__dict__
class B: name = 'B' b = B()
Creates an attribute of class B, and the attribute can be found in B.__dict__ , alternatively, if you have an instance b of type B, you can see class level attributes in b.__class__.__dict__
Tendayi Mawushe Sep 02 '08 at 15:12 2008-09-02 15:12
source share