Re: Wrap and intercept function calls

2010-02-17 Thread alex23
Terry Reedy wrote: > Now wrap *every* function you are interested in. Builtin functions are > no problem; methods of builtin classes cannont be wrapped without > subclassing. It's a shame it's not possible to do: type.__call__ = func_wrap(type.__call__) Or even: type.__class__ = NewTyp

Re: Wrap and intercept function calls

2010-02-17 Thread geremy condra
On Wed, Feb 17, 2010 at 11:04 AM, Dan Yamins wrote: > Really, nobody has any idea about this?   (Sorry to repost.) > > On Tue, Feb 16, 2010 at 7:29 PM, Dan Yamins wrote: >> >> Hi: >> >> I'm wondering what the best way to wrap and modify function calls is. >> Essentially what I want to achieve is

Re: Wrap and intercept function calls

2010-02-17 Thread Dan Yamins
> For CPython, alternative 1 is to create a custom interpreter to change > (wrap) the interpretation of the call-function bytecode in the ceval loop. > That is its 'call event', and I believe this would catch every explicit > f(args) call and only such calls. > > > Python has no general metasynta

Re: Wrap and intercept function calls

2010-02-17 Thread Terry Reedy
On 2/17/2010 11:04 AM, Dan Yamins wrote: Really, nobody has any idea about this? (Sorry to repost.) On Tue, Feb 16, 2010 at 7:29 PM, Dan Yamins mailto:dyam...@gmail.com>> wrote: Hi: I'm wondering what the best way to wrap and modify function calls is.Essentially what I want

Re: Wrap and intercept function calls

2010-02-17 Thread Dan Yamins
Really, nobody has any idea about this? (Sorry to repost.) On Tue, Feb 16, 2010 at 7:29 PM, Dan Yamins wrote: > Hi: > > 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: > > def Wrap(frame,event,arg): >

Wrap and intercept function calls

2010-02-16 Thread Dan Yamins
Hi: 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: def Wrap(frame,event,arg): if event == 'call': result = PerformCheck(GetArgumentsFromFrame(frame)) if Condition(result): r