Basically it contains all the attributes that describe the object in question. It can be used to modify or read attributes. Quote from this
A dictionary or other mapping object used to store attributes of objects (written).
Remember that all this is an object in python. When I say everything, I mean everything as functions, classes, objects, etc. (I read it right, classes. Classes are also objects). For example,
def func(): pass func.temp = 1 print func.__dict__ class TempClass(object): a = 1 def tempFunction(self): pass print TempClass.__dict__
Exit
{'temp': 1} {'a': 1, '__module__': '__main__', 'tempFunction': <function tempFunction at 0x7f77951a95f0>, '__dict__': <attribute '__dict__' of 'TempClass' objects>, '__weakref__': <attribute '__weakref__' of 'TempClass' objects>, '__doc__': None}
thefourtheye
source share