PyDocs

Nav

Debugging and profiling

Timer.print_exc

timeit

method of Timer (source)
  • Timer.print_exc(file=None)
Helper to print a traceback from the timed code.

Typical use:

    t = Timer(...)       # outside the try/except
    try:
        t.timeit(...)    # or t.repeat(...)
    except:
        t.print_exc()

The advantage over the standard traceback is that source lines
in the compiled template will be displayed.

The optional file argument directs where the traceback is
sent; it defaults to sys.stderr.

The optional colorize keyword argument controls whether the
traceback is colorized; it defaults to False for programmatic
usage. When used from the command line, this is automatically
set based on terminal capabilities.
0 Examples
No examples for timeit/Timer.print_exc.
See Also
No see-alsos for timeit/Timer.print_exc
0 Notes
No notes for Timer.print_exc