Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Gregory Ewing Newsgroups: comp.lang.python Subject: Re: Possibly Pythonic Tail Call Optimization (TCO/TRE) Date: Fri, 17 Jul 2015 11:41:39 +1200 Lines: 21 Message-ID: References: <87k2u2eu67.fsf@elektro.pacujo.net> <55A51662.4090007@rece.vub.ac.be> <55A75DE0.1070101@rece.vub.ac.be> <55A7B80B.6090905@rece.vub.ac.be> <55A7C094.7060604@rece.vub.ac.be> <55a7feed$0$1674$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net iGFmPOpf5F0dN+7T0QIpGgrQ/GnLBiB49OkIbVk90UOAB7N6qe Cancel-Lock: sha1:h+TmKpYWU4Njpxxmr2V02pH/vv8= User-Agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711) X-Accept-Language: en-us, en In-Reply-To: Xref: csiph.com comp.lang.python:93971 Joonas Liik wrote: > https://docs.python.org/2/library/sys.html#sys.setrecursionlimit > so as per the docs the programmer has no real control over how much > stack his program can have. all you can say is "let me ignore the > safeguard a little longer, i hope i wont crash the program" that is > not the same as "can i please have a stack depth of 20000.. I don't think there's much that can be done about that. If CPython doesn't impose an artificial limit, then it's at the mercy of the C compiler and runtime system as to the handling of stack overflows. The only way for CPython to take total control of the stack situation would be to get the C stack out of the picture altogether, using techniques such as the original Stackless Python employed. But the BDFL has ruled out CPython ever going that way, because it would massively warp the C API. -- Greg