Hi:<br><br>I'm wondering what the best way to wrap and modify function calls is. Essentially what I want to achieve is to have a function like this:<br> <br>def Wrap(frame,event,arg):<br> if event == 'call':<br>
result = PerformCheck(GetArgumentsFromFrame(frame))<br> if Condition(result):<br> return result <br> else:<br> return [normal function call]<br><br>called whenever a "call" event is about to occur. <br>
<br>When I say "return result" I mean: return that data object instead of what the function would have returned, and prevent execution of the function. <br> <br>Is there any way to do this using sys.settrace? Or perhaps something from the bdb or pbd module? <br>
<br>Thanks!<br>Dan<br><br><br>