Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   How override ALL function calls? (Is there a "function call function"?) (http://www.velocityreviews.com/forums/t347651-how-override-all-function-calls-is-there-a-function-call-function.html)

seberino@spawar.navy.mil 07-31-2005 07:01 PM

How override ALL function calls? (Is there a "function call function"?)
 
I'm trying run a homegrown profiler on some Python code.

Rather than apply profiler wrapper to ALL functions by hand....

Is there a low level Python function I can override to modify

how ALL functions are called?

Chris


=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= 07-31-2005 07:10 PM

Re: How override ALL function calls? (Is there a "function call function"?)
 
seberino@spawar.navy.mil wrote:
> I'm trying run a homegrown profiler on some Python code.
>
> Rather than apply profiler wrapper to ALL functions by hand....
>
> Is there a low level Python function I can override to modify
>
> how ALL functions are called?


Yes, please take a look at sys.setprofile().

Regards,
Martin

Bengt Richter 08-01-2005 12:38 PM

Re: How override ALL function calls? (Is there a "function call function"?)
 
On 31 Jul 2005 12:01:36 -0700, "seberino@spawar.navy.mil" <seberino@spawar.navy.mil> wrote:

>I'm trying run a homegrown profiler on some Python code.
>
>Rather than apply profiler wrapper to ALL functions by hand....
>
>Is there a low level Python function I can override to modify
>
>how ALL functions are called?
>

You may want to look at

>>> import sys
>>> help(sys.settrace)

Help on built-in function settrace in module sys:

settrace(...)
settrace(function)

Set the global debug tracing function. It will be called on each
function call. See the debugger chapter in the library manual.

Regards,
Bengt Richter


All times are GMT. The time now is 08:50 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.