is it possible to access the python function object attributes from within the function scope?
e.g. let\'s have
def f(): return
If you want it to be totally independent of the function name, you need some frame magic. For example:
def f2(): import inspect frame = inspect.currentframe() fname = frame.f_code.co_name fobj = frame.f_globals[fname] print fobj._x f2._x = 2 f2()