__dict__
holds attributes which describe the object. But it shows blank dictionary for function object.
I checked Python: Explain __dict__ attribute here but found no specific answer,though thefourtheye give this answer.
For a class, the variables inside it define the class but for a function, it is not. Then, what exactly defines function?
def bar(x):
return x + 1
print(bar.__dict__) #{}
class foo(object):
def bar(x):
return x + 1
print(foo.__dict__) #['bar': <function foo.bar at 0x058E0420>]