On Wed, 8 Jan 2014 16:23:06 -0500, eryksun <eryk...@gmail.com> wrote:
On Wed, Jan 8, 2014 at 3:25 PM, Keith Winston <keithw...@gmail.com>
wrote:
> I've been playing with recursion, it's very satisfying.
>
> However, it appears that even if I sys.setrecursionlimit(100000),
it blows
> up at about 24,000 (appears to reset IDLE). I guess there must be
a lot of
> overhead with recursion, if only 24k times are killing my memory?

I can't see the bodies of any of your messages (are you perchance posting in html? ), but I think there's a good chance you're abusing recursion and therefore hitting the limit much sooner than necessary. I've seen some code samples here using recursion to fake a goto, for example. One question to ask is whether each time you recurse, are you now solving a simpler problem. For example, when iterating over a tree you should only recurse when processing a SHALLOWER subtree.

--
DaveA

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to