Code goes first,
#Python 2.7
>>>class A(object):
pass
>>>a1 = A()
>>>a2 = A()
>>>A.__dict__
dict_proxy({'__dict__': <attribute '__dict__' of 'A' objects>, '__module__': '__main__', '__weakref__': <attribute '__weakref__' of 'A' objects>, '__doc__': None})
Question
1.what is dict_proxy
and why use it?
2.A.__dict__
contains an attr -- '__dict': <attribute '__dict__' of 'A' objects>
. What is this? Is it for a1
and a2
? But objects of A
have their own __dict__
, don't they?