Today I found that I can assign attribute to function, but when I tried to assign the attribute inside itself, I failed:
>>> def a():
... pass
...
>>> a.x = 1
>>> a.x
1
>>> def b():
... b.x = 2
...
>>> b.x
AttributeError: 'function' object has no attribute 'x'
Is there a way to assign attribute to a function inside himself?
If there isn't, what's the usage of a function's attribute?