Shorter tracebacks

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Sat Dec 13 09:13:20 EST 2008


When I write recursive code in Python I sometimes go past the maximum
allowed stack depth, so I receive a really long traceback. The show of
such traceback on my screen is very slow (despite a CPU able to
perform billions of operations each second). So I think I'd like
something to shorten them.
I am thinking about something like:
from __future__ import short_traceback

That allows me to see only the first and last parts of the stack
trace, and skips the (generally very redundant) middle part.

Note that generally using sys.setrecursionlimit(limit) to set a
smaller limit isn't good, because I may need a big depth anyway.

Bye,
bearophile



More information about the Python-list mailing list