adding new functionality to a function non-intrusively!
peter
Peter.Vandersteegen at gmail.com
Wed Feb 16 09:37:00 EST 2005
Hello all,
Recently I've started to refactor my code ...
I would like to add extra functionality to a function !non-intrusively!
(not rewriting the old code is really important)
How can I achieve this?
Thus I start with an old function named fA.
I would like to add extra functionality to fA.
Essentially this gives a new function fA which can call the old
function fA
thanks a lot for reading so far
Peter
ps.
following idea does not work!
# fA = old fA, already defined
def tempFunc(*args):
# do something with fA
return
fA = tempFunc # gives infinite loop, recursive mails
# this example is explained in more detail in other mail called:
"renaming 'references' to functions gives recursive problems'
More information about the Python-list
mailing list