is it possible to access the python function object attributes from within the function scope?
e.g. let\'s have
def f():
return
Sorry for the late reply but I just stumbled upon this. I would have to argue that the way that “g” is asked to work is non-Pythonic. Inside function, the name “f“ refers to the value of a global variable at the time the function is called. Given that, consider the following:
def f():
print(f)
f, g = 42, f
g() # prints 42
del f
g() # raises an exception
Hopefully, no one argues that this is incorrect behavior. Given that fact, I cam only vote for any answer that requires the use of a different variable name (e.g. “self”) inside the function.