Changing a function name does not make the new name callable:
>>> def f(): print 'called %s'%(f.__name__) ... >>> f() called f >>> f.__name__ = 'b' >>> f() called b >>> b() Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'b' is not defined
You will need to define b
in order to invoke it. And, as you saw, just assigning b=f
does not define a new function.
Aj.
source share