I want to use function attributes to set variable values as an alternate to using global variables. But sometimes I assign another short name to a function. The behavior seems to always do what I want, i.e. the value gets assigned to the function whether I use the long or short name, as shown below. Is there any danger in this?
def flongname():
pass
f = flongname
f.f1 = 10
flongname.f2 = 20
print flongname.f1, f.f2
And the last line returns 10 20 showing that the different function names refer to the same function object. Right?