Minimising stack trace

Skip Montanaro skip.montanaro at gmail.com
Fri May 15 15:14:07 EDT 2015


A third alternative is to take a look at asyncore.compact_traceback.
That will only help modestly in Cecil's example, but I found it
helpful.

Skip

On Fri, May 15, 2015 at 2:04 PM, Ned Batchelder <ned at nedbatchelder.com> wrote:
> On Friday, May 15, 2015 at 2:50:12 PM UTC-4, Cecil Westerhof wrote:
>> While playing with recursion I get:
>>     RuntimeError: maximum recursion depth exceeded in comparison
>>
>> But then I get a very long stack trace. Is there a way to make this a
>> lot shorter. Now I 'lose' interesting information because of the
>> length of the stack trace.
>
> There isn't a way to shorten the stack trace.  If you are losing
> information at the top because of your terminal window, you can
> likely increase the number of lines it will keep for you.
>
> Another option is to reduce the maximum stack depth, so that it
> is exceeded sooner, which produces shorter stack traces:
>
>     import sys;
>     sys.setrecursionlimit(50)
>
>
> --Ned.
> --
> https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list