Zooko zooko at
Thu Jan 3 19:26:05 CET 2002

I, Zooko, wrote the lines prepended with "> >":

 Gareth Rees <gdr at> wrote:
> >The usage interfaces are very different.  Not sure which, if either, 
> >is better.
> In the model you run tests, generate a report, use the 
> report to direct your testing activity to fruitful locations in the 
> code, generate a new report based on all the testing so far, and so 
> on.

I believe allows the same usage.

> > is much faster.  In my tests, takes less 
> >than 2 seconds where takes 30 seconds.
> It's obvious where the bottleneck is in a tracing or coverage 
> application: it's the function that you pass to sys.settrace.  Here's 
> the tracing function from
> c = {}
> def t(f, x, y):
>      c[(f.f_code.co_filename, f.f_lineno)] = 1
>      return t

I think you are right.  Here's the function in

def localtrace_count(self, frame, why, arg):
    if why == 'line':
        (filename, lineno, funcname, context, lineindex,) = inspect.getframeinfo(frame)
        key = (filename, lineno,)
        self.counts[key] = self.counts.get(key, 0) + 1
    return self.localtrace

I vaguely recall changing from `f.f_code.co_filename' to `inspect.getframeinfo()'
because I thought I had encountered some mysterious problems with the `f_' 

I'll experiment with and see if it handles Mojo Nation as well as does.



Security and Distributed Systems Engineering

More information about the Python-list mailing list