is it possible to access the python function object attributes from within the function scope?
e.g. let\'s have
def f():
return
Another way to accomplish this is to define the function inside another function, and have the outer function return the inner one. Then the inner function can access itself via a closure. Here's a simple example:
def makeFunc():
def f():
return f._x
return f
Then:
>>> f = makeFunc()
>>> f._x = "foo"
>>> f()
'foo'
>>> g = f
>>> del f
>>> g()
'foo'