X-Received: by 10.70.118.99 with SMTP id kl3mr14928291pdb.12.1431716667893; Fri, 15 May 2015 12:04:27 -0700 (PDT) X-Received: by 10.140.43.72 with SMTP id d66mr195239qga.25.1431716667845; Fri, 15 May 2015 12:04:27 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!j8no1980617igd.0!news-out.google.com!k20ni15678qgd.0!nntp.google.com!z60no753045qgd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.python Date: Fri, 15 May 2015 12:04:27 -0700 (PDT) In-Reply-To: <871tih66z5.fsf@Equus.decebal.nl> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=18.189.95.188; posting-account=Jod8CwoAAAD06WqLVFnlf8nIDonFoRWK NNTP-Posting-Host: 18.189.95.188 References: <871tih66z5.fsf@Equus.decebal.nl> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <2c2b0f1d-ce16-41b4-a12d-1cface2bf154@googlegroups.com> Subject: Re: Minimising stack trace From: Ned Batchelder Injection-Date: Fri, 15 May 2015 19:04:27 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: csiph.com comp.lang.python:90688 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.