very pythonic, very demure
>>106971022Hey OP I optimized your codedef doit(n=0x2000): return "Finished"doit()
def doit(n=0x2000): return "Finished"doit()
there's never a reason to use tail recursion instead of a loop in python
>>106971022recursion is only for functional languages like haskell
>>106972037also this. recursion is superior, but the reality is it fucks with debugging information which is why so many javascript engines drag their feet on the tail call part of the ES262 spec.
>>106972053depends
>>106971911python loops leak the counter variable due to shitty scoping, recusion sidesteps that
a brahmin lion doesn't concern himself with recursion
>>106971022>NOOOOOOOOO WHY DOES IT NOT ALLOW ME TO BLOW UP THE ST--ACK!!Recursion is a mental illness.
>can't do recursionsigns of a half-baked language
>>106972339>>106972412>meanwhile C>Depth: 261793>Segmentation fault#include <stdio.h>void recurse(int n) { printf("Depth: %d\n", n); recurse(n + 1);}int main() { recurse(1);}
#include <stdio.h>void recurse(int n) { printf("Depth: %d\n", n); recurse(n + 1);}int main() { recurse(1);}
>>106973386The common C compilers optimize tail calls though
>>106973579Except when they don't feel like doing it for whatever fucking reason.So you shouldn't rely on it.
>>106973613https://clang.llvm.org/docs/AttributeReference.html#musttail
>>106973579tail call optimization is turning void f() { f(); } into while (1) {}the compiled code is not recursion anymore, rather it's now a loopbe less retarded, son
void f() { f(); }
while (1) {}
>>106973613>>106973704retards>>106973985