<div dir="ltr">I don't think setrecursionlimit is the answer here. It's like answering "hey maybe we can save some cash here" with "why not just make more money?".<div><br></div><div style>The fact that python's conventions encourages using iterators and explicit state machines instead of tail-recursion and tail-calls is worth something, but simply saying "it slows down all computation for rare benefit" and "does not scale well" is rather hand wavy. We already are not going to process billion character strings with iteration in python (python loops are sloooow). There are some (not-factorial) algorithms which are more naturally expressed recursively than iteratively.</div>

<div style><br></div><div style>Saying recursion is slower and more memory intensive than iteration (true), and thus we shouldn't think about making recursion less slow or less memory intensive doesn't really make much sense to me. </div>

<div style><br></div><div style>This is an extremely novel idea, which begs the question: has it been done before? In any other language/runtime? And how did it turn out? A cursory googling doesn't get me anything, and my gut says this is more PhD thesis than quick hack.</div>

<div style><br></div><div style>-Haoyi</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, May 26, 2013 at 9:30 PM, alex23 <span dir="ltr"><<a href="mailto:wuwei23@gmail.com" target="_blank">wuwei23@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On May 27, 6:23 am, Ram Rachum <<a href="mailto:r...@rachum.com">r...@rachum.com</a>> wrote:<br>
> So in those cases where you have to use recursion, it would be nice if the<br>
> stack could be compressed so the program could put 1000x many frames on the<br>
> stack and will be less likely to crash.<br>
<br>
<a href="http://docs.python.org/2/library/sys.html#sys.setrecursionlimit" target="_blank">http://docs.python.org/2/library/sys.html#sys.setrecursionlimit</a><br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div></div></blockquote></div><br></div>