4 ms·
> Python limits it arbitrarily, just to force you to use its fancy iteration system. Python has an arbitrary and low default limit because it isn’t optimized (
by dragonwriter 4y ago
> Python limits it arbitrarily, just to force you to use its fancy iteration system.
Python has an arbitrary and low default limit because it isn’t optimized (because stack traces are considered important), abd call depth is an effifiency issue that risks blowing up without a limim because of stack depth, and failing fast in the likely-erroneous case of deep call stack given all that is just sensible. Python also. Lets you alter the limit at runtime; ita a soft, not hard, limit. The hard limit is stack space.
- tlb 4y agoPeople often talk about accidental infinite recursion, but that seems like a rare mistake. I might have done it twice in a 40 year career? It's much rarer than an accidental infinite loop, which (almost) no language tries to protect you against. It doesn't seem worth giving up useful recursion. Python's "solution" requires changing a global, which is an ugly thing for a library that wants to recurse to do.
- versteegen 4y agoYou or the code you write must be extremely unusual. I might have blown the stack a thousand times, in many different languages. Probably most of the time I wasn't intentionally recursing at all.