3 ms·
CPython doesn't do TCO, but you can implement it yourself in Python. This version is one of my all-time favorite StackOverflow answers: https://stackoverflow.c
by FreakLegion 2y ago
CPython doesn't do TCO, but you can implement it yourself in Python.
This version is one of my all-time favorite StackOverflow answers: https://stackoverflow.com/questions/13591970/does-python-optimize-tail-recursion/18506625#18506625 https://stackoverflow.com/questions/13591970/does-python-opt...
- zelphirkalt 2y agoLooks like trampolines inside Y combinator. Interesting approach. Still of course with its own costs. I think some of the Scheme in JS implementation(s?) use trampolines as well, or at least considered doing that.