2 ms·
As Guido says, TCO is not an optimzation, it's a language feature. Here's his reason, which I think is pretty sound: "Second, the idea that TRE is merely an op
by steveklabnik 17y ago
As Guido says, TCO is not an optimzation, it's a language feature. Here's his reason, which I think is pretty sound:
"Second, the idea that TRE is merely an optimization, which each Python implementation can choose to implement or not, is wrong. Once tail recursion elimination exists, developers will start writing code that depends on it, and their code won't run on implementations that don't provide it: a typical Python implementation allows 1000 recursions, which is plenty for non-recursively written code and for code that recurses to traverse, for example, a typical parse tree, but not enough for a recursively written loop over a large list." - http://neopythonic.blogspot.com/2009/04/tail-recursion-elimination.html http://neopythonic.blogspot.com/2009/04/tail-recursion-elimi...