renaming 'references' to functions can give recursive problems

Michael Spencer mahs at telcopartners.com
Thu Feb 17 00:40:47 EST 2005


peter wrote:
> brain reset and understood 
> 
> thx a lot for all your answers
> 
> Peter
> 
Now that you've got reset, you might want to consider an alternative solution:

def fA(input):
   return input

oldfA = fA   # Hold a reference to the the old function

def newFA(input):
    "Do something new"
    return oldfA(input)

fA = newFA


The advantage of this is that you don't need to change the function newfA at all 
when you're ready to rename it.

Michael




More information about the Python-list mailing list